<?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>23860</bug_id>
          
          <creation_ts>2013-11-19 17:21:00 +0000</creation_ts>
          <short_desc>Remove getElementById() from Element</short_desc>
          <delta_ts>2013-11-28 21:28:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne">annevk</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>erik.arvidsson</cc>
    
    <cc>mike</cc>
    
    <cc>miketaylr</cc>
    
    <cc>mtanalin</cc>
    
    <cc>waldron.rick</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>96519</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-19 17:21:00 +0000</bug_when>
    <thetext>jQuery made it web-incompatible. We can only have it on Document and DocumentFragment.

If there&apos;s potential other things we only want there we might want to introduce NonElementParentNode as group.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96520</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-19 17:27:37 +0000</bug_when>
    <thetext>Document, DocumentFragment, and SVGSVGElement, fwiw.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96521</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-19 17:30:26 +0000</bug_when>
    <thetext>Right. I should ping www-svg@w3.org to get them to point to our definition.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96543</commentid>
    <comment_count>3</comment_count>
    <who name="Marat Tanalin | tanalin.com">mtanalin</who>
    <bug_when>2013-11-19 21:39:16 +0000</bug_when>
    <thetext>(In reply to Anne from comment #0)
&gt; jQuery made it web-incompatible.

Could you share some details? Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96545</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-19 21:41:32 +0000</bug_when>
    <thetext>jQuery 1.2.5 assumes that any node it found in the DOM that has a &quot;getElementById&quot; property is a Document node.  See https://bugzilla.mozilla.org/show_bug.cgi?id=933193#c17</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96547</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-19 21:42:14 +0000</bug_when>
    <thetext>Er, I meant jQuery 1.2.6, but 1.2.5 in fact has the same code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96606</commentid>
    <comment_count>6</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-20 22:24:38 +0000</bug_when>
    <thetext>Can someone point me to the relevant discussions that lead to the addition of &quot;getElementById&quot; to Element, thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96608</commentid>
    <comment_count>7</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-20 22:42:33 +0000</bug_when>
    <thetext>Probably starting at http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jun/0207.html and then going on approximately forever.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96617</commentid>
    <comment_count>8</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-21 01:00:20 +0000</bug_when>
    <thetext>This is unfortunate. If it were an issue with a modern version of the library, I&apos;d personally commit to resolving it, but unfortunately a version from 5 years ago requires a time machine and mine is in the shop. 

@mozillians: Is there any way to gather info on jQuery version use in Firefox? I&apos;m willing to do evangelism, on behalf of jQuery, for any major site breakage this change may cause—if there is a way to identify breakage? Can the change be made temporarily? In a Nightly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96618</commentid>
    <comment_count>9</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-21 01:05:18 +0000</bug_when>
    <thetext>I have no idea how realistic this is, but if you asked me to guess, this is pretty close to what I would say the usage is http://w3techs.com/technologies/details/js-jquery/1/all</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96622</commentid>
    <comment_count>10</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-21 03:30:45 +0000</bug_when>
    <thetext>&gt; @mozillians: Is there any way to gather info on jQuery version use in Firefox?

We can try, but the version is often in neither the url nor the actual script...

Also worth asking the Blink folks if they can do this.

&gt; for any major site breakage this change may cause—if there is a way to identify
&gt; breakage?

That&apos;s the problem.  The symptom is that some queries will just return the wrong nodeset.  What happens after that depends on what the site is doing.  And no breakage today is no guarantee of anything tomorrow.  :(

&gt; Can the change be made temporarily? In a Nightly?

We could try; we&apos;d have to disable our jQuery regression tests or something, since those also break with the change (which is how the problem was discovered).  That has its own problems, obviously.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96649</commentid>
    <comment_count>11</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-21 19:24:47 +0000</bug_when>
    <thetext>(In reply to Boris Zbarsky from comment #10)
&gt; &gt; @mozillians: Is there any way to gather info on jQuery version use in Firefox?
&gt; 
&gt; We can try, but the version is often in neither the url nor the actual
&gt; script...
&gt; 

jQuery.fn.jQuery is where the version is always exposed, since 1.3 (if it&apos;s not present, then &quot;mostly&quot; safe to assume it&apos;s pre-1.3)

&gt; Also worth asking the Blink folks if they can do this.

Agreed! 

&gt; 
&gt; &gt; for any major site breakage this change may cause—if there is a way to identify
&gt; &gt; breakage?
&gt; 
&gt; That&apos;s the problem.  The symptom is that some queries will just return the
&gt; wrong nodeset.  What happens after that depends on what the site is doing. 
&gt; And no breakage today is no guarantee of anything tomorrow.  :(
&gt; 
&gt; &gt; Can the change be made temporarily? In a Nightly?
&gt; 
&gt; We could try; we&apos;d have to disable our jQuery regression tests or something,
&gt; since those also break with the change (which is how the problem was
&gt; discovered).  That has its own problems, obviously.

Of course and I will understand if this can&apos;t happen at all. I will continue to seeking more information about version usage and will post back here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96653</commentid>
    <comment_count>12</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-21 19:36:49 +0000</bug_when>
    <thetext>&gt; jQuery.fn.jQuery is where the version is always exposed

Mmm...  We could try to look for that, but invoking functions of the page when they don&apos;t expect to be like that is pretty dangerous from a compat standpoint (and hence there is real infrastructure for doing it, since we never want to do it).  :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96656</commentid>
    <comment_count>13</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-21 19:41:38 +0000</bug_when>
    <thetext>It&apos;s a property(In reply to Boris Zbarsky from comment #12)
&gt; &gt; jQuery.fn.jQuery is where the version is always exposed
&gt; 
&gt; Mmm...  We could try to look for that, but invoking functions of the page
&gt; when they don&apos;t expect to be like that is pretty dangerous from a compat
&gt; standpoint (and hence there is real infrastructure for doing it, since we
&gt; never want to do it).  :(

It&apos;s a property :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96658</commentid>
    <comment_count>14</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-21 20:04:12 +0000</bug_when>
    <thetext>A property get is in general a function call, though.  We don&apos;t have a sane way from the non-js-engine part of gecko to do &quot;get this property, but only if it&apos;s a value property and if you can determine that without running any script (e.g. none of the objects are proxies)&quot;...  We could try to add a bunch of complex code to do that, I guess...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96660</commentid>
    <comment_count>15</comment_count>
    <who name="Marat Tanalin | tanalin.com">mtanalin</who>
    <bug_when>2013-11-21 20:15:24 +0000</bug_when>
    <thetext>A couple of ideas about how jQuery could be precisely identified:

1. compare checksums (predefined in browser) of official JS files distributed via jQuery website with checksums of files which URL (or filename) contains &quot;jquery&quot; string (most likely jQuery file is typically used as is -- without modifications);

2. take URLs of jQuery hosted on popular CDN&apos;s (e.g. Google&apos;s) into account.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96661</commentid>
    <comment_count>16</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-21 20:23:56 +0000</bug_when>
    <thetext>(In reply to Marat Tanalin | tanalin.com from comment #15)
&gt; A couple of ideas about how jQuery could be precisely identified:
&gt; 
&gt; 1. compare checksums (predefined in browser) of official JS files
&gt; distributed via jQuery website with checksums of files which URL (or
&gt; filename) contains &quot;jquery&quot; string (most likely jQuery file is typically
&gt; used as is -- without modifications);

For statically scanning the official release of jQuery:

- the minified version string looks like: `f=&quot;1.10.2&quot;`
- the source version string looks like: `core_version = &quot;1.10.2&quot;`

But this may appear differently in older versions of jQuery. 

The header of jquery.js and jquery.min.js also include version:

&quot;v1.10.2&quot;

This pattern (ie. &quot;v1.x[.x]&quot; has been the same since jQuery 1.3

&gt; 
&gt; 2. take URLs of jQuery hosted on popular CDN&apos;s (e.g. Google&apos;s) into account.

Yep, this was #1 on my list to check into :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96665</commentid>
    <comment_count>17</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2013-11-21 21:11:40 +0000</bug_when>
    <thetext>Why was getElementById added to ParentNode in the first place?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96668</commentid>
    <comment_count>18</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-21 22:47:20 +0000</bug_when>
    <thetext>Erik, see comment 7.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96695</commentid>
    <comment_count>19</comment_count>
    <who name="Mike Taylor">miketaylr</who>
    <bug_when>2013-11-22 16:06:46 +0000</bug_when>
    <thetext>I asked Corey of the jQuery infrastructure team to pull stats on downloads from their code.jquery.com CDN: https://gist.github.com/gnarf/471375415438802390a9. This data is &quot;this month from one of the cdn hosts&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96828</commentid>
    <comment_count>20</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-26 13:54:02 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/f71d7de304e1ee25573279157dd6ce1c2aa2c4f2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96830</commentid>
    <comment_count>21</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-11-26 15:30:44 +0000</bug_when>
    <thetext>(In reply to Anne from comment #20)
&gt; https://github.com/whatwg/dom/commit/f71d7de304e1ee25573279157dd6ce1c2aa2c4f2

Based on the CDN request data the Mike provided above, there were only 6,952 requests for jQuery 1.2.x, out of total 34,201,901 valid requests for jQuery (0.02033%).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96850</commentid>
    <comment_count>22</comment_count>
    <who name="Marat Tanalin | tanalin.com">mtanalin</who>
    <bug_when>2013-11-26 20:20:40 +0000</bug_when>
    <thetext>By the way, on syntax level, we could just add context element as optional second parameter to existing `document.getElementById()` method so that

    document.getElementById(&apos;example&apos;, someElement)

would be equivalent to

    someElement.getElementById(&apos;example&apos;)

Same is probably applicable to DocumentFragment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96912</commentid>
    <comment_count>23</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-28 14:10:02 +0000</bug_when>
    <thetext>Rick, if you can get Chrome to implement it on Element, or manage to change bz&apos; mind for Firefox, I will update the specification. For now I&apos;m happy with moving forward with just adding it to DocumentFragment (and therefore ShadowRoot).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96913</commentid>
    <comment_count>24</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2013-11-28 15:24:06 +0000</bug_when>
    <thetext>I still don&apos;t get it. Why do we want getElementById on Element?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96914</commentid>
    <comment_count>25</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-11-28 15:29:42 +0000</bug_when>
    <thetext>Erik, did you read the mailing list discussion about that exact question?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96920</commentid>
    <comment_count>26</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2013-11-28 21:28:21 +0000</bug_when>
    <thetext>(In reply to Boris Zbarsky from comment #25)
&gt; Erik, did you read the mailing list discussion about that exact question?

Yes. I didn&apos;t find a conclusion to that thread and the arguments were not very convincing. Anyway, please feel free to ignore me.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>