net-set
net-set copied to clipboard
replace username spaces with hyphen
This fixes jQuery selector unrecognized expression errors and empty ID selector results caused when a username has spaces.
Since username is used for ID selectors, it should be formatted properly. Google recommends hyphens: https://google.github.io/styleguide/htmlcssguide.xml#ID_and_Class_Name_Delimiters
Although I guess this also opens the door to a whole bunch of design questions:
- What about other characters that should be escaped?
"for example in a username would break things. - Should there be character restrictions on usernames?
- Maybe make 2 versions of usernames? One that is user friendly and one HTML attribute friendly.
- Should players have IDs? Then attributes could be something like
player-<id>keeping things uniform.
4 on that list is an important one. Just made me realize as I was typing it that a player could have the username sidebar which would create an HTML ID conflict. Definitely should consider a uniform alternative to the naming convention to prevent something like that from happening.