<?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>27569</bug_id>
          
          <creation_ts>2014-12-11 14:59:32 +0000</creation_ts>
          <short_desc>Move getElementsBy* to ParentNode?</short_desc>
          <delta_ts>2014-12-13 19:36:57 +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>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>crimsteam</cc>
    
    <cc>dglazkov</cc>
    
    <cc>mike</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>116144</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-11 14:59:32 +0000</bug_when>
    <thetext>https://dom.spec.whatwg.org/#interface-document

In the spec getElementsByTagName, getElementsByTagNameNS and getElementsByClassName are on Document and Element separately.

They&apos;re also on ShadowRoot, which inherits from DocumentFragment:
http://w3c.github.io/webcomponents/spec/shadow/#shadowroot-object

Putting it on ParentNode seems like a simplification, and that&apos;s also where querySelector and querySelectorAll live.

The observable difference would be that getElementsBy* become usable on non-ShadowRoot DocumentFragments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116145</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-12-11 15:23:10 +0000</bug_when>
    <thetext>See bug 23860 :-(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116146</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-11 15:24:25 +0000</bug_when>
    <thetext>Sorry, I did read about that before filing, I mean NonElementParentNode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116147</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-11 15:25:50 +0000</bug_when>
    <thetext>Trying again. The problem is with Element.getElementById(). getElementsBy* is already on Element. Putting these on ParentNode should only affect non-ShadowRoot DocumentFragments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116149</commentid>
    <comment_count>4</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2014-12-11 15:32:13 +0000</bug_when>
    <thetext>I proposed the same thing for the same reason some time ago to Anne (via email) but don&apos;t get any answer why not:), but happy that getElementById() was added and now we can use it in DocumentFragment. 

Summary I thought that is the reason: nobody want extend usage of old collection like HTMLCollection. But this change will be nice simplification for specs and using for newbie; still see a lot of questions why Document|DocumentFragment.getElementsBy* not work (the same was for getElementById()). Maybe now I can read reason why they can&apos;t be move to ParentNode.

Of course moving to NonElementParentNode also looks good, maybe some days old jQuery disappear completely. But hmm:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23860#c4

BZ:
[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}

so moving getElementsBy* to ParentNode will breake jQuery to?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116151</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-12-11 15:55:09 +0000</bug_when>
    <thetext>So yeah the story is that getElementBy* methods that are not getElementById should not be added to more objects since we want developers to move away from them. Therefore there&apos;s an outstanding bug on shadow DOM to remove them from ShadowRoot.

jQuery is only affected by getElementById as I understand it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116164</commentid>
    <comment_count>6</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-11 19:43:17 +0000</bug_when>
    <thetext>Where&apos;s the bug to remove getElementsBy* from ShadowRoot?

Why do we want to avoid spreading getElementsBy* to DocumentFragment? At least in Blink it wouldn&apos;t add any complexity, it&apos;s already implementing in a base class shared by DocumentFragment and the others. The reason I filed this bug is in fact because it looks like a simplification, by having these defined in a single place in the IDL as well, instead of spread out in this odd fashion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116165</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-12-11 19:57:36 +0000</bug_when>
    <thetext>Bug 23620.

It&apos;s a simplification to go from just Document and Element, to Document, DocumentFragment, and Element? That sounds odd. Are you sure that&apos;s not due to them existing on ShadowRoot at the moment?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116167</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-11 20:10:38 +0000</bug_when>
    <thetext>Right, it would be a simplification to move it up from ShadowRoot to DocumentFragment and then to ParentNode as that would complete the Document-DocumentFragment-Element trio that implement ParentNode.

If these are dropped from ShadowRoot then only Document and Element would remain and at best they could have a new common interface, but I&apos;ll comment on bug 23620 before speculating further.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116202</commentid>
    <comment_count>9</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-12 08:52:42 +0000</bug_when>
    <thetext>In bug 23620 Dimitri isn&apos;t excited about dropping getElementsBy* from ShadowRoot.

The path I would suggest is to move getElementsBy* to ParentNode and then remove them from ShadowRoot in specs and implementation. Other than discouraging use of live HTMLCollection, is there any reason to avoid exposing getElementsBy* on DocumentFragment?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116221</commentid>
    <comment_count>10</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2014-12-12 16:04:31 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #9)
&gt; In bug 23620 Dimitri isn&apos;t excited about dropping getElementsBy* from
&gt; ShadowRoot.
&gt; 
&gt; The path I would suggest is to move getElementsBy* to ParentNode and then
&gt; remove them from ShadowRoot in specs and implementation. Other than
&gt; discouraging use of live HTMLCollection, is there any reason to avoid
&gt; exposing getElementsBy* on DocumentFragment?

Oh crap. All this time I was reading &quot;getElementsBy*&quot; as &quot;getElementById&quot;.

Now that I am actually reading this correctly, I think we should go ahead with deprecating ShadowRoot.getElementsBy*.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116234</commentid>
    <comment_count>11</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-12 19:47:05 +0000</bug_when>
    <thetext>OK, will you remove them from the spec as well? I&apos;ll send an Intent to Deprecate.

Whether or not to have getElementsBy* on DocumentFragment is a separate matter, although my argument for simplicity becomes weaker with them gone from ShadowRoot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116269</commentid>
    <comment_count>12</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-13 19:36:57 +0000</bug_when>
    <thetext>I&apos;m WONTFIXing this. With getElementsBy* being removed from ShadowRoot, the argument for simplification becomes much weaker, and I believe sticking to just Document and Element will allow us to reach interop faster.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>