@@ -818,6 +818,12 @@ <h3>Endpoints</h3>
818818 < td > < a > Get Active Element</ a > </ td >
819819 </ tr >
820820
821+ < tr >
822+ < td > GET</ td >
823+ < td > /session/{< var > session id</ var > }/element/{element id}/shadow</ td >
824+ < td > < a > Get Element Shadow Root</ a > </ td >
825+ </ tr >
826+
821827 < tr >
822828 < td > POST</ td >
823829 < td > /session/{< var > session id</ var > }/element</ td >
@@ -842,6 +848,18 @@ <h3>Endpoints</h3>
842848 < td > < a > Find Elements From Element</ a > </ td >
843849 </ tr >
844850
851+ < tr >
852+ < td > POST</ td >
853+ < td > /session/{< var > session id</ var > }/shadow/{shadow id}/element</ td >
854+ < td > < a > Find Element From Shadow Root</ a > </ td >
855+ </ tr >
856+
857+ < tr >
858+ < td > POST</ td >
859+ < td > /session/{< var > session id</ var > }/shadow/{shadow id}/elements</ td >
860+ < td > < a > Find Elements From Shadow Root</ a > </ td >
861+ </ tr >
862+
845863 < tr >
846864 < td > GET</ td >
847865 < td > /session/{< var > session id</ var > }/element/{< var > element id</ var > }/selected</ td >
@@ -1215,6 +1233,13 @@ <h3>Errors</h3>
12151233 could not be satisfied because the window could not be found.
12161234 </ tr >
12171235
1236+ < tr >
1237+ < td > < dfn > no such shadow root</ dfn >
1238+ < td > 404
1239+ < td > < code > no such shadow root</ code >
1240+ < td > The element does not have a shadow root.
1241+ </ tr >
1242+
12181243 < tr >
12191244 < td > < dfn > script timeout error</ dfn >
12201245 < td > 500
@@ -1237,6 +1262,14 @@ <h3>Errors</h3>
12371262 the referenced < a > element</ a > is no longer attached to the DOM.
12381263 </ tr >
12391264
1265+ < tr >
1266+ < td > < dfn > detached shadow root</ dfn >
1267+ < td > 404
1268+ < td > < code > detached shadow root</ code >
1269+ < td > A < a > command</ a > failed because
1270+ the referenced < a > shadow root</ a > is no longer attached to the DOM.
1271+ </ tr >
1272+
12401273 < tr >
12411274 < td > < dfn > timeout</ dfn >
12421275 < td > 500
@@ -4314,14 +4347,113 @@ <h3>Interactability</h3>
43144347</ ol >
43154348</ section > <!-- /Interactability -->
43164349
4350+ < section >
4351+ < h3 id =shadow-root > Shadow Roots</ h3 >
4352+ < p > A < dfn data-lt ="shadow roots "> shadow root</ dfn >
4353+ is an abstraction used to identify a < a > shadow root</ a >
4354+ when it is transported via the < a href ="#protocol "> protocol</ a > ,
4355+ between < a > remote</ a > - and < a > local</ a > ends.
4356+
4357+ < p > The < dfn > shadow root identifier</ dfn > is the string constant
4358+ "< code > shadow-6066-11e4-a52e-4f735466cecf</ code > ".
4359+
4360+ < p > Each < a > shadow root</ a > has an associated < dfn > shadow root
4361+ reference</ dfn > that uniquely identifies the < a > element</ a > across
4362+ all < a > browsing contexts</ a > . The < a > shadow root reference</ a > for
4363+ every < a > shadow root</ a > representing the same < a > shadow root</ a > must be the
4364+ same. It must be a string, and should be the result of < a > generating
4365+ a UUID</ a > .
4366+
4367+ < p > An ECMAScript < a > Object</ a > < dfn > represents a shadow root</ dfn >
4368+ if it has a < a > shadow root identifier</ a > < a > own property</ a > .
4369+
4370+ < p > Each < a > browsing context</ a > has an associated < dfn > list of
4371+ known shadow roots</ dfn > .
4372+ When the < a > browsing context</ a > is < a > discarded</ a > ,
4373+ the < a > list of known shadow roots</ a > is discarded along with it.
4374+
4375+ < p > To < dfn > get a known shadow root</ dfn > with
4376+ argument < var > reference</ var > , run the following steps:
4377+
4378+ < ol >
4379+ < li > Let < var > shadow</ var > be the item in the < a > current browsing
4380+ context</ a > ’s < a > list of known shadow roots</ a > for which the < a > shadow
4381+ root reference</ a > is equal to < var > reference</ var > , if such a
4382+ shadow root exists. Otherwise return < a > error</ a > with < a > error
4383+ code</ a > < a > no such element</ a > .
4384+ < li > If < var > shadow</ var > < a > is detached</ a > , return
4385+ < a > error</ a > with < a > error code</ a >
4386+ < a > detached shadow root</ a > .
4387+ < li > Return < a > success</ a > with < var > shadow</ var > .
4388+ </ ol >
4389+
4390+ < p > To < dfn > get a known connected shadow root</ dfn > with
4391+ argument < var > reference</ var > , run the following steps:
4392+ < ol >
4393+ < li > Let < var > shadow</ var > be the result of < a > trying</ a > to < a > get
4394+ a known shadow root</ a > with argument < var > reference</ var > .
4395+ < li > If < var > shadow</ var > < a > is detached</ a >
4396+ return < a > error</ a > with error code < a > detached shadow root</ a > .
4397+ < li > Return < a > success</ a > with < var > shadow</ var > .
4398+ </ ol >
4399+
4400+ < p > To < dfn data-lt ="create a shadow root "> create a shadow root reference</ dfn >
4401+ for a < a > < var > shadow root</ var > </ a > :
4402+
4403+ < ol >
4404+ < li > < p > For each < var > known shadow root</ var >
4405+ of the < a > current browsing context</ a > ’s < a > list of known shadow roots</ a > :
4406+
4407+ < ol >
4408+ < li > < p > If < var > known shadow root</ var > < a > equals</ a > < var > shadow root</ var > ,
4409+ return < a > success</ a > with < var > known shadow root</ var > ’s < a > shadow root reference</ a > .
4410+ </ ol >
4411+
4412+ < li > < p > Add < var > shadow</ var > to
4413+ the < a > list of known shadow roots</ a > of the < a > current browsing context</ a > .
4414+
4415+ < li > < p > Return < a > success</ a > with the
4416+ < var > shadow</ var > ’s < a > shadow root reference</ a > .
4417+ </ ol >
4418+
4419+ < p > The < dfn > JSON serialization of a shadow root</ dfn >
4420+ is a JSON < a > Object</ a > where the < a > shadow root identifier</ a > key
4421+ is mapped to the < a > shadow root</ a > ’s < a > shadow root reference</ a > .
4422+
4423+ < p > When required to < dfn > deserialize a shadow root</ dfn >
4424+ by a JSON < a > Object</ a > < var > object</ var > that < a > represents a shadow root</ a > :
4425+
4426+ < ol >
4427+ < li > < p > If < var > object</ var > has no < a > own property</ a > < a > shadow root identifier</ a > ,
4428+ return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
4429+
4430+ < li > < p > Let < var > reference</ var > be the result of
4431+ < a data-lt ="getting a property "> getting</ a >
4432+ the < a > shadow root identifier</ a > property
4433+ from < var > object</ var > .
4434+
4435+ < li > < p > Let < var > shadow</ var > be the result
4436+ of < a > trying</ a > to < a > get a known shadow root</ a >
4437+ with argument < var > reference</ var > .
4438+
4439+ < li > < p > Return < a > success</ a > with data < var > shadow</ var > .
4440+ </ ol >
4441+
4442+ < p > An < a > shadow root</ a > < dfn > is detached</ dfn >
4443+ if its < a > node document</ a > is not the < a > active document</ a >
4444+ or if the element node referred to as its < a > document fragment host</ a >
4445+ < a > is stale</ a > .
4446+ </ section > <!-- Shadow Roots -->
43174447
43184448< section >
43194449< h3 id =element-retrieval > Retrieval</ h3 >
43204450
43214451< p > The < a > Find Element</ a > ,
43224452 < a > Find Elements</ a > ,
43234453 < a > Find Element From Element</ a > ,
4324- and < a > Find Elements From Element</ a > < a > commands</ a >
4454+ < a > Find Elements From Element</ a > ,
4455+ < a > Find Element From Shadow Root</ a > ,
4456+ and < a > Find Elements From Shadow Root</ a > < a > commands</ a >
43254457 allow lookup of individual elements and collections of elements.
43264458 Element retrieval searches are performed
43274459 using pre-order traversal of the document’s nodes
@@ -4772,6 +4904,101 @@ <h4><dfn>Find Elements From Element</dfn></h4>
47724904</ ol >
47734905</ section > <!-- /Find Elements From Element -->
47744906
4907+ < section >
4908+ < h4 > < dfn > Find Element From Shadow Root</ dfn > </ h4 >
4909+
4910+ < table class ="simple jsoncommand ">
4911+ < tr >
4912+ < th > HTTP Method</ th >
4913+ < th > URI Template</ th >
4914+ </ tr >
4915+ < tr >
4916+ < td > POST</ td >
4917+ < td > /session/{< var > session id</ var > }/shadow/{< var > shadow id</ var > }/element</ td >
4918+ </ tr >
4919+ </ table >
4920+
4921+ < p > The < a > remote end steps</ a > are:
4922+
4923+ < ol >
4924+ < li > < p > Let < var > location strategy</ var > be the result
4925+ of < a > getting a property</ a > called "< code > using</ code > ".
4926+
4927+ < li > < p > If < var > location strategy</ var > is not present as a keyword in the
4928+ < a > table of location strategies</ a > , return < a > error</ a > with
4929+ < a > error code</ a > < a > invalid argument</ a > .
4930+
4931+ < li > < p > Let < var > selector</ var > be the result
4932+ of < a > getting a property</ a > called "< code > value</ code > ".
4933+
4934+ < li > < p > If < var > selector</ var > is < a > undefined</ a > ,
4935+ return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
4936+
4937+ < li > < p > If the < a > current browsing context</ a > is < a > no longer
4938+ open</ a > , return < a > error</ a > with < a > error code</ a > < a > no such
4939+ window</ a > .
4940+
4941+ < li > < p > < a > Handle any user prompts</ a > and return its value if it is an < a > error</ a > .
4942+
4943+ < li > < p > Let < var > start node</ var > be the result
4944+ of < a > trying</ a > to < a > get a known connected shadow root</ a >
4945+ with < a > url variable</ a > < var > shadow id</ var > .
4946+
4947+ < li > Let < var > result</ var > be the value of < a > trying</ a > to < a > Find</ a > with
4948+ < var > start node</ var > , < var > location strategy</ var > ,
4949+ and < var > selector</ var > .
4950+
4951+ < li > < p > If < var > result</ var > is empty, return < a > error</ a >
4952+ with < a > error code</ a > < a > no such shadow root</ a > . Otherwise, return the
4953+ first element of < var > result</ var > .
4954+ </ ol >
4955+ </ section > <!-- /Find Element From Shadow Root -->
4956+
4957+ < section >
4958+ < h4 > < dfn > Find Elements From Shadow Root</ dfn > </ h4 >
4959+
4960+ < table class ="simple jsoncommand ">
4961+ < tr >
4962+ < th > HTTP Method</ th >
4963+ < th > URI Template</ th >
4964+ </ tr >
4965+ < tr >
4966+ < td > POST</ td >
4967+ < td > /session/{< var > session id</ var > }/shadow/{< var > shadow id</ var > }/elements</ td >
4968+ </ tr >
4969+ </ table >
4970+
4971+ < p > The < a > remote end steps</ a > are:
4972+
4973+ < ol >
4974+ < li > < p > Let < var > location strategy</ var > be the result
4975+ of < a > getting a property</ a > called "< code > using</ code > ".
4976+
4977+ < li > < p > If < var > location strategy</ var > is not present as a keyword in the
4978+ < a > table of location strategies</ a > , return < a > error</ a > with
4979+ < a > error code</ a > < a > invalid argument</ a > .
4980+
4981+ < li > < p > Let < var > selector</ var > be the result
4982+ of < a > getting a property</ a > called "< code > value</ code > ".
4983+
4984+ < li > < p > If < var > selector</ var > is < a > undefined</ a > ,
4985+ return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
4986+
4987+ < li > < p > If the < a > current browsing context</ a > is < a > no longer
4988+ open</ a > , return < a > error</ a > with < a > error code</ a > < a > no such
4989+ window</ a > .
4990+
4991+ < li > < p > < a > Handle any user prompts</ a > and return its value if it is an < a > error</ a > .
4992+
4993+ < li > < p > Let < var > start node</ var > be the result
4994+ of < a > trying</ a > to < a > get a known connected shadow root</ a >
4995+ with < a > url variable</ a > < var > shadow id</ var > .
4996+
4997+ < li > Return the result of < a > trying</ a > to < a > Find</ a > with
4998+ < var > start node</ var > , < var > location strategy</ var > , and < var > selector</ var > .
4999+ </ ol >
5000+ </ section > <!-- /Find Elements From Shadow Root -->
5001+
47755002< section >
47765003< h4 > < dfn > Get Active Element</ dfn > </ h4 >
47775004
@@ -4804,6 +5031,57 @@ <h4><dfn>Get Active Element</dfn></h4>
48045031 < p > Otherwise, return < a > error</ a > with < a > error code</ a > < a > no such element</ a > .
48055032</ ol >
48065033</ section > <!-- /Get Active Element -->
5034+
5035+ < section >
5036+ < h4 > < dfn > Get Element Shadow Root</ dfn > </ h4 >
5037+
5038+ < table class ="simple jsoncommand ">
5039+ < tr >
5040+ < th > HTTP Method</ th >
5041+ < th > URI Template</ th >
5042+ </ tr >
5043+ < tr >
5044+ < td > GET</ td >
5045+ < td > /session/{< var > session id</ var > }/element/shadow</ td >
5046+ </ tr >
5047+ </ table >
5048+
5049+ < p > The < a > remote end steps</ a > are:
5050+
5051+ < ol >
5052+ < li > < p > If the < a > current browsing context</ a > is < a > no longer
5053+ open</ a > , return < a > error</ a > with < a > error code</ a > < a > no such
5054+ window</ a > .
5055+
5056+ < li > < p > < a > Handle any user prompts</ a > and return its value if it is an < a > error</ a > .
5057+
5058+ < li > < p > Let < var > element</ var > be the result
5059+ of < a > trying</ a > to < a > get a known connected element</ a >
5060+ with < a > url variable</ a > < var > element id</ var > .
5061+
5062+ < li > < p > Let < var > shadow root</ var > be the result of getting an
5063+ < a > own property</ a > named "shadowRoot" from < var > element</ var > .
5064+
5065+ < li > < p > If < var > shadow root</ var > is undefined, return < a > error</ a >
5066+ with < a > error code</ a > < a > no such shadow root</ a > .
5067+
5068+ < li > < p > Let < var > shadow root node type</ var > be the result of
5069+ getting an < a > own property</ a > named "nodeType" from
5070+ < var > shadow root</ var > .
5071+
5072+ < li > < p > If < var > shadow root node type</ var > is undefined, or has
5073+ a value other than 11, return < a > error</ a > with < a > error code</ a >
5074+ < a > no such shadow root</ a > .
5075+
5076+ < li > < p > Let < var > shadow host</ var > be the result of getting an
5077+ < a > own property</ a > named "host" of < var > shadow root</ var > .
5078+
5079+ < li > < p > If < var > shadow host</ var > is not undefined or null, return
5080+ < a > create a shadow root reference</ a > .
5081+
5082+ < p > Otherwise, return < a > error</ a > with < a > error code</ a > < a > no such shadow root</ a > .
5083+ </ ol >
5084+ </ section > <!-- /Get Element Shadow Root -->
48075085</ section > <!-- /Retrieval -->
48085086
48095087< section >
@@ -10346,6 +10624,7 @@ <h2>Index</h2>
1034610624 <!-- Document element --> < li > < dfn > < a href =https://dom.spec.whatwg.org/#document-element > Document element</ a > </ dfn >
1034710625 <!-- Document --> < li > < dfn > < a href =https://dom.spec.whatwg.org/#concept-document > Document</ a > </ dfn >
1034810626 <!-- DOCUMENT_POSITION_DISCONNECTED --> < li > < dfn > < a href =https://dom.spec.whatwg.org/#dom-node-document_position_disconnected > DOCUMENT_POSITION_DISCONNECTED</ a > </ dfn > (1)
10627+ <!-- document fragment host --> < li > < dfn data-lt ="document fragment host "> < a href =https://dom.spec.whatwg.org/#concept-documentfragment-host > < code > document fragment host</ code > </ a > </ dfn >
1034910628 <!-- Document type --> < li > < dfn > < a href =https://dom.spec.whatwg.org/#concept-document-type > Document type</ a > </ dfn >
1035010629 <!-- Document URL --> < li > < dfn > < a href =https://dom.spec.whatwg.org/#concept-document-url > Document URL</ a > </ dfn >
1035110630 <!-- Element --> < li > < dfn data-lt =elements > < a href =https://dom.spec.whatwg.org/#concept-element > Element</ a > </ dfn >
@@ -10373,7 +10652,7 @@ <h2>Index</h2>
1037310652 in the Document Object Model specification: [[DOM]]
1037410653 < ul >
1037510654 <!-- textContent attribute --> < li > < dfn data-lt =textContent > < a href =https://dom.spec.whatwg.org/#dom-node-textcontent > < code > textContent</ code > attribute</ a > </ dfn >
10376- </ ul >
10655+ </ ul >
1037710656
1037810657 < dd > < p > The following terms are defined in
1037910658 the DOM Parsing and Serialization specification: [[DOM-PARSING]]
0 commit comments