3

I.E:

  • <a href="foo.com" class="bar">
  • <a/href="foo.com"/class="bar">

Space and / are two valid separator between href and class.

  • In which RFC is this defined?
  • What are the other valid attributes separators?

Sample: https://jsfiddle.net/yeg58qun/

Slake
  • 2,080
  • 3
  • 25
  • 32
  • 4
    Where did you read that / is a valid attribute separator? – BoltClock Feb 15 '19 at 14:12
  • https://jsfiddle.net/yeg58qun/ – Slake Feb 15 '19 at 14:18
  • 5
    That's not a source. That's just markup that appears to work despite [being invalid](https://checker.html5.org/?showsource=yes&doc=data%3Atext%2Fhtml%3Bcharset%3Dutf-8%2C%3C%21DOCTYPE+html%3E%3Chtml+lang%3Den%3E%3Ctitle%3E%2F+as+attribute+separator%3C%2Ftitle%3E%250A%3Ca%2Fhref%3D%22foo.com%22%2Fclass%3D%22bar%22%3E%3C%2Fa%3E%250A%3Csvg%2Fonload%3Dalert%28%27slash%27%29%3E%3C%2Fsvg%3E). – BoltClock Feb 15 '19 at 14:20

1 Answers1

5

HTML hasn't been maintained in an RFC document for decades. You can find two slightly incompatible specifications, one a W3C TR and the other maintained by the WHATWG. Most browsers follow their own nebulous intersection of the two.

The only valid attribute separator is whitespace. This isn't stated normatively in the spec, but one of the parse errors that can be triggered when validating markup is called missing-whitespace-between-attributes:

This error occurs if the parser encounters attributes that are not separated by ASCII whitespace (e.g., <div id="foo"class="bar">). In this case the parser behaves as if ASCII whitespace is present.

That last sentence would also explain why your markup seems to work as expected.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356