getElement* functions have been removed, [1], [2], from the ShadowRoot.
[1]:
https://github.com/w3c/webcomponents/commit/3d5f147812edaf74cc4f07d294836cafdf48534f
[2]:
https://github.com/w3c/webcomponents/commit/6416fdfe7fc87e47aa89aac8ce5430389b9ad653
See also the relevant discussions:
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=23620
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=27569
I think it's coincidence, but I added the following note to the spec
yesterday to make the spec reader-friendly.
-
https://github.com/w3c/webcomponents/commit/b43d98149c4c4a401fe35e115afc548031bdbc6d
It might be also worth mentioning that you can use
ShadowRoot.getElementById in a non-normative way there. Strictly speaking,
we don't have to mention it in the spec because it's implied.
On Fri, Mar 27, 2015 at 5:44 AM Elliott Sprehn <esprehn@chromium.org> wrote:
> On Thu, Mar 26, 2015 at 1:38 PM, Ryosuke Niwa <rniwa@apple.com> wrote:
>
>>
>> On Mar 26, 2015, at 1:23 PM, Travis Leithead <
>> travis.leithead@microsoft.com> wrote:
>>
>> You make a series of excellent points.
>>
>>
>>
>> In the sense that you have a new set of nodes to manage holistically,
>> then having some sort of “document” container does makes sense for that (a
>> ShadowRoot) in order to place all your search/navigation APIs.
>>
>>
>>
>> You got me thinking though—getElementById is currently not available on
>> ShadowRoot right? Does that API in the host’s document find IDs in the
>> shadow? I presume not given the guidelines you mentioned. I wonder what
>> other APIs from Document are desired?
>>
>>
>> I thought getElementById existed in ShadowRoot at some point but the
>> latest Blink code doesn't have it. It looks like Blink has
>> querySelector/querySelectorAll via ParentNode:
>>
>>
>> https://chromium.googlesource.com/chromium/blink/+/master/Source/core/dom/shadow/ShadowRoot.idl
>>
>> https://chromium.googlesource.com/chromium/blink/+/master/Source/core/dom/ParentNode.idl
>>
>>
> The spec changed,
> https://dom.spec.whatwg.org/#interface-nonelementparentnode
>
> ShadowRoot is a DocumentFragment and DocumentFragment implements
> NonElementParentNode.
>
> - E
>