<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>14145</bug_id>
          
          <creation_ts>2011-09-14 10:44:47 +0000</creation_ts>
          <short_desc>Spaces in id attributes [was Could we define the id attribute so as to allow multiple unique ids to point to the same DOM element, by separating the names given in the value by spaces?]</short_desc>
          <delta_ts>2011-10-19 23:10:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#the-id-attribute</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>laura.lee.carlson</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>thaddee.tyl</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>56763</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-09-14 10:44:47 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html
Multipage: http://www.whatwg.org/C#the-id-attribute
Complete: http://www.whatwg.org/c#the-id-attribute

Comment:
Could we define the id attribute so as to allow multiple unique ids to point
to the same DOM element, by separating the names given in the value by spaces?

Posted from: 134.214.169.135
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.9 Safari/535.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56764</commentid>
    <comment_count>1</comment_count>
    <who name="Thaddee TYL">thaddee.tyl</who>
    <bug_when>2011-09-14 10:52:50 +0000</bug_when>
    <thetext>The specification currently says:

&quot;This specification doesn&apos;t preclude an element having multiple IDs, if other mechanisms (e.g. DOM Core methods) can set an element&apos;s ID in a way that doesn&apos;t conflict with the id attribute.&quot;

It also says:

&quot;The value [of an ID attribute] must not contain any space characters.&quot;

 and later:

&quot;[] user agents must associate the element with the given value (exactly, including any space characters)&quot;

The current state in Google Chrome, Firefox and Opera (at least) is that space characters are not allowed in IDs: if they have a space in their value, you cannot refer to them at all, even if it is a trailing space.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56768</commentid>
    <comment_count>2</comment_count>
    <who name="Thaddee TYL">thaddee.tyl</who>
    <bug_when>2011-09-14 12:00:21 +0000</bug_when>
    <thetext>It seems that, due to an error in the tests I did, my previous comment is wrong.

Chrome, Firefox and Opera all allow spaces in id attributes without any need to escape using %20.

I therefore suggest to remove the sentence that says:

&quot;The value must not contain any space characters.&quot;

and to remove the paragraph that says:

&quot;This specification doesn&apos;t preclude an element having multiple IDs, if other mechanisms (e.g. DOM Core methods) can set an element&apos;s ID in a way that doesn&apos;t conflict with the id attribute.&quot;

as Anne Van Kesteren suggested to me on #whatwg.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56770</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-09-14 12:57:10 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; I therefore suggest to remove the sentence that says:
&gt; 
&gt; &quot;The value must not contain any space characters.&quot;

Allowing spaces in IDs would break things that have a list of space-separated IDs, e.g. &lt;td headers&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56783</commentid>
    <comment_count>4</comment_count>
    <who name="Thaddee TYL">thaddee.tyl</who>
    <bug_when>2011-09-14 20:29:29 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; I therefore suggest to remove the sentence that says:
&gt; &gt; 
&gt; &gt; &quot;The value must not contain any space characters.&quot;
&gt; 
&gt; Allowing spaces in IDs would break things that have a list of space-separated
&gt; IDs, e.g. &lt;td headers&gt;.

While I understand this position, I would like to mention the fact that, while browsers currently accept id values with spaces in them, they disregard &lt;td headers&gt; completely (see http://jsbin.com/aguhuf/3) because they do not implement DOM4&apos;s DOMSettableTokenList.

Since I hope to have DOM4 implemented in browsers, I wish to +1 Simon Pieters on this one.

My updated request is therefore to:

- remove the parenthesized expression here:

&quot;[] user agents must associate the element with the given value (exactly,
including any space characters)&quot;

- remove the paragraph that says:

&quot;This specification doesn&apos;t preclude an element having multiple IDs, if other
mechanisms (e.g. DOM Core methods) can set an element&apos;s ID in a way that
doesn&apos;t conflict with the id attribute.&quot;

---

On the other hand, I would rather we specified the behavior that browsers should follow when encountering an id value that contains a space.

Along the suggestions that spring to mind:

- Remove the id attribute (which will break the page if a script relies on it)
- Remove the spaces in the id value (which will break the page just as much)
- Let it pass, but show a warning in the dev tools, and let the page fail if a &lt;td headers&gt; refers to it (which may have unexpected results since the @id value will be cut in half in the @headers value)

We should make it clear that this isn&apos;t optimum behavior, though. Having this parenthesized &quot;exactly, including any space characters&quot; puzzles me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58468</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-19 23:10:41 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: We now defer to the DOM Core specification for the ID attribute stuff, so this is no longer in scope for the HTML spec.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>