@@ -5208,7 +5208,7 @@ interface Document : Node {
5208
5208
[NewObject] Comment createComment(DOMString data);
5209
5209
[NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
5210
5210
5211
- [CEReactions, NewObject] Node importNode(Node node, optional boolean subtree = false);
5211
+ [CEReactions, NewObject] Node importNode(Node node, optional ( boolean or ImportNodeOptions) options = false);
5212
5212
[CEReactions] Node adoptNode(Node node);
5213
5213
5214
5214
[NewObject] Attr createAttribute(DOMString localName);
@@ -5227,8 +5227,14 @@ interface Document : Node {
5227
5227
interface XMLDocument : Document {};
5228
5228
5229
5229
dictionary ElementCreationOptions {
5230
+ CustomElementRegistry customElements;
5230
5231
DOMString is;
5231
5232
};
5233
+
5234
+ dictionary ImportNodeOptions {
5235
+ CustomElementRegistry customElements;
5236
+ selfOnly = false;
5237
+ }
5232
5238
</pre>
5233
5239
5234
5240
<p> {{Document}} <a for=/>nodes</a> are simply
@@ -5450,12 +5456,19 @@ method steps are to return the <a>list of elements with class names <var>classNa
5450
5456
<var> document</var> is an <a>HTML document</a> or <var> document</var> 's
5451
5457
<a for=Document>content type</a> is "<code> application/xhtml+xml</code> "; otherwise null.
5452
5458
5453
- <p> If <var> localName </var> does not match the <code> <a type>Name</a> </code> production an
5454
- " {{InvalidCharacterError!!exception}} " {{DOMException}} will be thrown .
5459
+ <p> When supplied, <var> options </var> 's {{ElementCreationOptions/customElements}} can be used to
5460
+ set the {{CustomElementRegistry}} .
5455
5461
5456
5462
<p> When supplied, <var> options</var> 's {{ElementCreationOptions/is}} can be used to create a
5457
5463
<a>customized built-in element</a> .
5458
5464
5465
+ <p> If <var> localName</var> does not match the <code> <a type>Name</a> </code> production an
5466
+ "{{InvalidCharacterError!!exception}} " {{DOMException}} will be thrown.
5467
+
5468
+ <p> When both <var> options</var> 's {{ElementCreationOptions/customElements}} and
5469
+ <var> options</var> 's {{ElementCreationOptions/is}} are supplied, a
5470
+ "{{NotSupportedError!!exception}} " {{DOMException}} will be thrown.
5471
+
5459
5472
<dt><code><var> element</var> = <var> document</var> . <a method for=Document lt=createElementNS()>createElementNS(namespace, qualifiedName [, options])</a> </code>
5460
5473
5461
5474
<dd>
@@ -5464,6 +5477,12 @@ method steps are to return the <a>list of elements with class names <var>classNa
5464
5477
<var> qualifiedName</var> or null. Its <a for=Element>local name</a> will be everything after
5465
5478
U+003A (:) in <var> qualifiedName</var> or <var> qualifiedName</var> .
5466
5479
5480
+ <p> When supplied, <var> options</var> 's {{ElementCreationOptions/customElements}} can be used to
5481
+ set the {{CustomElementRegistry}} .
5482
+
5483
+ <p> When supplied, <var> options</var> 's {{ElementCreationOptions/is}} can be used to create a
5484
+ <a>customized built-in element</a> .
5485
+
5467
5486
<p> If <var> qualifiedName</var> does not match the <code> <a type>QName</a> </code> production an
5468
5487
"{{InvalidCharacterError!!exception}} " {{DOMException}} will be thrown.
5469
5488
@@ -5486,8 +5505,9 @@ method steps are to return the <a>list of elements with class names <var>classNa
5486
5505
is "<code> xmlns</code> ".
5487
5506
</ul>
5488
5507
5489
- <p> When supplied, <var> options</var> 's {{ElementCreationOptions/is}} can be used to create a
5490
- <a>customized built-in element</a> .
5508
+ <p> When both <var> options</var> 's {{ElementCreationOptions/customElements}} and
5509
+ <var> options</var> 's {{ElementCreationOptions/is}} are supplied, a
5510
+ "{{NotSupportedError!!exception}} " {{DOMException}} will be thrown.
5491
5511
5492
5512
<dt><code><var ignore> documentFragment</var> = <var> document</var> . {{createDocumentFragment()}} </code>
5493
5513
<dd> Returns a {{DocumentFragment}} <a for=/>node</a> .
@@ -5533,18 +5553,15 @@ method steps are:
5533
5553
<li><p> If <a>this</a> is an <a>HTML document</a> , then set <var> localName</var> to
5534
5554
<var> localName</var> in <a>ASCII lowercase</a> .
5535
5555
5536
- <li><p> Let <var> is</var> be null.
5537
-
5538
- <li><p> If <var> options</var> is a <a for=/>dictionary</a> and
5539
- <var> options</var> ["{{ElementCreationOptions/is}}"] <a for=map>exists</a> , then set <var> is</var>
5540
- to it.
5556
+ <li><p> Let <var> registry</var> and <var> is</var> be the result of
5557
+ <a>flattening element creation options</a> given <var> options</var> and <a>this</a> .
5541
5558
5542
5559
<li><p> Let <var> namespace</var> be the <a>HTML namespace</a> , if <a>this</a> is an
5543
5560
<a>HTML document</a> or <a>this</a> 's <a for=Document>content type</a> is
5544
5561
"<code> application/xhtml+xml</code> "; otherwise null.
5545
5562
5546
5563
<li><p> Return the result of <a>creating an element</a> given <a>this</a> , <var> localName</var> ,
5547
- <var> namespace</var> , null, <var> is</var> , and true .
5564
+ <var> namespace</var> , null, <var> is</var> , true, and <var> registry </var> .
5548
5565
</ol>
5549
5566
5550
5567
<p> The <dfn noexport>internal <code>createElementNS</code> steps</dfn> , given <var> document</var> ,
@@ -5554,14 +5571,12 @@ method steps are:
5554
5571
<li><p> Let <var> namespace</var> , <var> prefix</var> , and <var> localName</var> be the result of
5555
5572
passing <var> namespace</var> and <var> qualifiedName</var> to <a>validate and extract</a> .
5556
5573
5557
- <li><p> Let <var> is</var> be null.
5558
-
5559
- <li><p> If <var> options</var> is a <a for=/>dictionary</a> and
5560
- <var> options</var> ["{{ElementCreationOptions/is}}"] <a for=map>exists</a> , then set <var> is</var>
5561
- to it.
5574
+ <li><p> Let <var> registry</var> and <var> is</var> be the result of
5575
+ <a>flattening element creation options</a> given <var> options</var> and <a>this</a> .
5562
5576
5563
5577
<li><p> Return the result of <a>creating an element</a> given <var> document</var> ,
5564
- <var> localName</var> , <var> namespace</var> , <var> prefix</var> , <var> is</var> , and true.
5578
+ <var> localName</var> , <var> namespace</var> , <var> prefix</var> , <var> is</var> , true, and
5579
+ <var> registry</var> .
5565
5580
</ol>
5566
5581
5567
5582
<p> The
@@ -5570,6 +5585,31 @@ method steps are to return the result of running the
5570
5585
<a>internal <code>createElementNS</code> steps</a> , given <a>this</a> , <var> namespace</var> ,
5571
5586
<var> qualifiedName</var> , and <var> options</var> .
5572
5587
5588
+ <p> To <dfn>flatten element creation options</dfn> , given a string or {{ElementCreationOptions}}
5589
+ dictionary <var> options</var> and a <a for=/>document</a> <var> document</var> :
5590
+
5591
+ <ol>
5592
+ <li><p> Let <var> registry</var> be null.
5593
+
5594
+ <li><li> Let <var> is</var> be null.
5595
+
5596
+ <li>
5597
+ <p> If <var> options</var> is a dictionary:
5598
+
5599
+ <ol>
5600
+ <li><p> If <var> options</var> ["{{ElementCreationOptions/customElements}}"] <a for=map>exists</a> ,
5601
+ then set <var> registry</var> to it.
5602
+
5603
+ <li><p> If <var> options</var> ["{{ElementCreationOptions/is}}"] <a for=map>exists</a> , then set
5604
+ <var> is</var> to it.
5605
+ </ol>
5606
+
5607
+ <li><p> If <var> registry</var> is non-null and <var> is</var> is non-null, then <a>throw</a> a
5608
+ "{{NotSupportedError!!exception}} " {{DOMException}} .
5609
+
5610
+ <li><p> Return <var> registry</var> and <var> is</var> .
5611
+ </ol>
5612
+
5573
5613
<p class=note> {{Document/createElement()}} and {{Document/createElementNS()}} 's <var> options</var>
5574
5614
parameter is allowed to be a string for web compatibility.
5575
5615
@@ -5635,11 +5675,15 @@ method steps are:
5635
5675
<hr>
5636
5676
5637
5677
<dl class=domintro>
5638
- <dt><var> clone</var> = <var> document</var> . <a method for=Document lt=importNode()>importNode(<var>node</var> [, <var>subtree </var> = false])</a>
5678
+ <dt><var> clone</var> = <var> document</var> . <a method for=Document lt=importNode()>importNode(<var>node</var> [, <var>options </var> = false])</a>
5639
5679
<dd>
5640
- <p> Returns a copy of <var> node</var> . If <var> subtree</var> is true, the copy also includes the
5680
+ <p> Returns a copy of <var> node</var> . If <var> options</var> is true or <var> options</var> is a
5681
+ dictionary whose {{ImportNodeOptions/selfOnly}} is false, the copy also includes the
5641
5682
<var> node</var> 's <a for=tree>descendants</a> .
5642
5683
5684
+ <p> If <var> options</var> 's {{ImportNodeOptions/customElements}} can be used to set the
5685
+ {{CustomelementRegistry}} of elements that have none.
5686
+
5643
5687
<p> If <var> node</var> is a <a for=/>document</a> or a <a for=/>shadow root</a> , throws a
5644
5688
"{{NotSupportedError!!exception}} " {{DOMException}} .
5645
5689
@@ -5655,16 +5699,34 @@ method steps are:
5655
5699
</dl>
5656
5700
5657
5701
<div algorithm>
5658
- <p> The <dfn method for=Document><code>importNode(<var>node</var>, <var>subtree </var>)</code></dfn>
5702
+ <p> The <dfn method for=Document><code>importNode(<var>node</var>, <var>options </var>)</code></dfn>
5659
5703
method steps are:
5660
5704
5661
5705
<ol>
5662
5706
<li><p> If <var> node</var> is a <a for=/>document</a> or <a for=/>shadow root</a> , then <a>throw</a>
5663
5707
a "{{NotSupportedError!!exception}} " {{DOMException}} .
5664
5708
5709
+ <li><p> Let <var> subtree</var> be false.
5710
+
5711
+ <li><p> Let <var> registry</var> be false.
5712
+
5713
+ <li><p> If <var> options</var> is a boolean, then set <var> subtree</var> to <var> options</var> .
5714
+
5715
+ <li>
5716
+ <p> Otherwise:
5717
+
5718
+ <ol>
5719
+ <li><p> Set <var> subtree</var> to the negation of
5720
+ <var> options</var> ["{{ImportNodeOptions/selfOnly}}"] .
5721
+
5722
+ <li><p> If <var> options</var> ["{{ImportNodeOptions/customElements}}"] <a for=map>exists</a> , then
5723
+ set <var> registry</var> to it.
5724
+ </ol>
5725
+
5665
5726
<li><p> Return the result of <a>cloning a node</a> given <var> node</var> with
5666
- <a for="clone a node"><i>document</i></a> set to <a>this</a> and
5667
- <a for="clone a node"><i>subtree</i></a> set to <var> subtree</var> .
5727
+ <a for="clone a node"><i>document</i></a> set to <a>this</a> ,
5728
+ <a for="clone a node"><i>subtree</i></a> set to <var> subtree</var> , and
5729
+ <a for="clone a node"><i>fallbackRegistry</i></a> set to <var> registry</var> .
5668
5730
</ol>
5669
5731
</div>
5670
5732
@@ -6439,12 +6501,12 @@ value of these steps:
6439
6501
<var> document</var> , string <var> localName</var> , string-or-null <var> namespace</var> , and
6440
6502
optionally a string-or-null <var> prefix</var> (default null), string-or-null <var> is</var> (default
6441
6503
null), boolean <var> synchronousCustomElements</var> (default false), and null or a
6442
- {{CustomElementRegistry}} object <var> registry</var> :
6504
+ {{CustomElementRegistry}} object <var> registry</var> (default null) :
6443
6505
6444
6506
<ol>
6445
6507
<li><p> Let <var> result</var> be null.
6446
6508
6447
- <li><p> If <var> registry</var> is not given , then set <var> registry</var> to the result of
6509
+ <li><p> If <var> registry</var> is null , then set <var> registry</var> to the result of
6448
6510
<b> looking up a custom element registry</b> given <var> document</var> .
6449
6511
<!-- XXX xref -->
6450
6512
0 commit comments