id=♥ + #♥ { background: lime; }
id=© + #© { background: lime; }
id=“‘’” + #“‘’” { background: lime; }
id=☺☃ + #☺☃ { background: lime; }
id=⌘⌥ + #⌘⌥ { background: lime; }
id=𝄞♪♩♫♬ + #𝄞♪♩♫♬ { background: lime; }
id=? + #\? { background: lime; }
id=@ + #\@ { background: lime; }
id=. + #\. { background: lime; }
id=:) + #\3A \) { background: lime; }
id=:`( + #\3A \`\( { background: lime; }
id=123 + #\31 23 { background: lime; }
id=1a2b3c + #\31 a2b3c { background: lime; }
id=<p> + #\<p\> { background: lime; }
id=<><<<>><> + #\<\>\<\<\<\>\>\<\> { background: lime; }
id=++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. + #\+\+\+\+\+\+\+\+\+\+\[\>\+\+\+\+\+\+\+\>\+\+\+\+\+\+\+\+\+\+\>\+\+\+\>\+\<\<\<\<\-\]\>\+\+\.\>\+\.\+\+\+\+\+\+\+\.\.\+\+\+\.\>\+\+\.\<\<\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\.\>\.\+\+\+\.\-\-\-\-\-\-\.\-\-\-\-\-\-\-\-\.\>\+\.\>\. { background: lime; }
id=# + #\# { background: lime; }
id=## + #\#\# { background: lime; }
id=#.#.# + #\#\.\#\.\# { background: lime; }
id=_ + #\_ { background: lime; }
id={} + #\{\} { background: lime; }
id=.fake-class + #\.fake\-class { background: lime; }
id=foo.bar + #foo\.bar { background: lime; }
id=:hover + #\3A hover { background: lime; }
id=:hover:focus:active + #\3A hover\3A focus\3A active { background: lime; }
id=[attr=value] + #\[attr\=value\] { background: lime; }
id=f/o/o + #f\/o\/o { background: lime; }
id=f\o\o + #f\\o\\o { background: lime; }
id=f*o*o + #f\*o\*o { background: lime; }
id=f!o!o + #f\!o\!o { background: lime; }
id=f'o'o + #f\'o\'o { background: lime; }
id=f~o~o + #f\~o\~o { background: lime; }
id=f+o+o + #f\+o\+o { background: lime; }
As the spec says…
Attributes are placed inside the start tag, and consist of a name and a value, separated by an
=character. The attribute value can remain unquoted if it doesn’t contain spaces or any of"'`=<or>. Otherwise, it has to be quoted using either single or double quotes. The value, along with the=character, can be omitted altogether if the value is the empty string.
Note that instead of “spaces”, it should really say “whitespace” there. (Bug #12938)
At this point, there are only four validation errors on this page – can you spot them?
href=//føø.bár.chhref=//føøbár.ch/føø/bárhref=http://1.2.3.4/href=mailto:foo@bar.comhref=foo@bar.com??href=mailto:foo@bar.com??href=mailto:foo@bar.com..href=mailto:foo@bar.com?subject=Test%20subject&body=Hello%20there!!href=ftp://ftp.example.comhref=irc://irc.example.comhref=ftp://ftp.example.com/foohref=irc://irc.example.com/foohref=ftp://1.2.3.4href=file:///foo.txthref=http://benalman.comhref=http://benalman.com/href=http://benalman.xyzhref=http://benalman.xyz/href=http://benalman.com??href=http://benalman.com/??href=http://benalman.xyz??href=http://benalman.xyz/??href=http://foo@benalman.comhref=http://foo:bar@benalman.comhref=http://benalman.com:81href=http://benalman.com:81/href=http://xyz@benalman.com:81/href=https://xyz@benalman.com:81/href=http://hosthref=http://host/href=http://host.comhref=http://subdomain.host.comhref=http://host.com:81href=http://user@host.comhref=http://user@host.com:81href=http://user:@host.comhref=http://user:@host.com:81href=http://user:pass@host.comhref=http://user:pass@host.com:81href=http://user:pass@host.com:81?queryhref=http://user:pass@host.com:81#anchorhref=http://user:pass@host.com:81/href=http://user:pass@host.com:81/?queryhref=http://user:pass@host.com:81/#anchorhref=http://user:pass@host.com:81/file.exthref=http://user:pass@host.com:81/directoryhref=http://user:pass@host.com:81/directory?queryhref=http://user:pass@host.com:81/directory#anchorhref=http://user:pass@host.com:81/directory/href=http://user:pass@host.com:81/directory/?queryhref=http://user:pass@host.com:81/directory/#anchorhref=http://user:pass@host.com:81/directory/sub.directory/href=http://user:pass@host.com:81/directory/sub.directory/file.exthref=http://user:pass@host.com:81/directory/file.ext?queryhref=http://user:pass@host.com:81/directory/file.ext?query=1&test=2href=http://user:pass@host.com:81/directory/file.ext?query=1#anchorhref=host.com:81:81href=host.com:81/:81/href=host.com:81/direc.tory/file.ext?query=1&test=2#anchor:81/direc.tory/file.ext?query=1&test=2#anchorhref=http://msdn.microsoft.com/en-us/library/ms536429(v=vs.85).aspxhref=http://example.com/file\u00a0name.htmlhref=http://example.com/ilovearrows<<<<.htmlhref=http://example.com/escaped%20spaces.htmlhref=http://example.com/non breaking space.htmlhref=http://example.com/i love tabs.html (tabs = whitespace so this will add two new attributes: love and tabs.html)href=a 1.2.3.4a (this adds a new attribute 1.2.3.4a)href=1.2.3.4 a a (this adds a new attribute a)href=a 1.2.3.4 aa a (this adds three new attributes: 1.2.3.4a, aa, and a)By now the validation error count is going through the roof.