Search code examples
htmlinternet-explorerweb-standardsquirks-mode

Will adding rel or name attributes to divs and spans cause IE/FF to go into quirks mode?


Will a tag like

<span id="suchAndSuch" class="blah" rel="this.that.other" name="this.name"></span>

or

<div id="suchAndSuch" class="blah" rel="this.that.other" name="this.name"></div>

throw IE and/or FF to QM? According to W3C, those aren't standard attributes for those tags, but it does not say if it'll make them invalid.

Your help is much appreciated.


Solution

  • No, it will not throw a browser into quirks mode. Not having a DOCTYPE or having a HTML comment (or any HTML content) before a DOCTYPE will throw browsers into quirks mode.

    If you can avoid using custom attributes, you should. If you cannot, you might want to consider using a HTML5 doctype, and then using data attributes. For instance, what you wrote could be done like this:

    <div id="suchAndSuch" class="blah" data-references="this.that.other" data-name="this.name"></div>
    

    And that would still be valid, as well as supported by modern browsers (and even a number of older ones).