I was browsing a site and found this line of code:
<div class="section slideshow" id="/featured/">
I've never seen slashes in an id tag before, is this poor coding, a problem written out by the database, or something else?
Slashes in an id
attribute is not a valid character:
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
Maybe to use it directly in an url and/or with javascript...
Maybe he use this method for insert to database(insert id in a string) or go to an url .
Slashe is not a valid character for ID in html 4.01 but its valid in html5 .
For html 4.01
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
Reference : What are valid values for the id attribute in HTML?
http://www.w3.org/TR/html5/global-attributes.html#the-id-attribute
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With