Skip to content

Commit 096a2a1

Browse files
committed
Fix and clarify more around CDATASection
* Make appendChild(cdata) and similar not throw. * Let nodeName be #cdata-section. * Include CDATASection as a node in an exhaustive enumeration. * Collapse cases of Text+PI+Comment to CharacterData where possible so that it's more clear that subtypes are included. * Say "depending on" instead of "switched" on. Part of #300.
1 parent 53fb898 commit 096a2a1

File tree

1 file changed

+27
-40
lines changed

1 file changed

+27
-40
lines changed

dom.bs

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ can be used to explore this matter in more detail.
14881488

14891489
<h3 id=node-trees>Node tree</h3>
14901490

1491-
<p>{{Document}}, {{DocumentType}}, {{DocumentFragment}}, {{Element}}, {{Text}},
1491+
<p>{{Document}}, {{DocumentType}}, {{DocumentFragment}}, {{Element}}, {{Text}}, {{CDATASection}},
14921492
{{ProcessingInstruction}}, and {{Comment}} objects (simply called
14931493
<dfn export id=concept-node>nodes</dfn>) <a>participate</a> in a <a>tree</a>, simply named the
14941494
<dfn export id=concept-node-tree>node tree</dfn>.
@@ -1509,10 +1509,11 @@ can be used to explore this matter in more detail.
15091509
</ol>
15101510
<dt>{{DocumentFragment}}
15111511
<dt>{{Element}}
1512-
<dd><p>Zero or more nodes each of which is {{Element}}, {{Text}}, {{ProcessingInstruction}}, or
1513-
{{Comment}}.
1512+
<dd><p>Zero or more nodes each of which is {{Element}}, {{Text}}, {{CDATASection}},
1513+
{{ProcessingInstruction}}, or {{Comment}}.
15141514
<dt>{{DocumentType}}
15151515
<dt>{{Text}}
1516+
<dt>{{CDATASection}}
15161517
<dt>{{ProcessingInstruction}}
15171518
<dt>{{Comment}}
15181519
<dd><p>None.
@@ -1526,9 +1527,7 @@ The <dfn export id=concept-node-length for=Node>length</dfn> of a
15261527
<dt>{{DocumentType}}
15271528
<dd>Zero.
15281529

1529-
<dt>{{Text}}
1530-
<dt>{{ProcessingInstruction}}
1531-
<dt>{{Comment}}
1530+
<dt>{{CharacterData}}
15321531
<dd>Its {{CharacterData/length}} attribute
15331532
value.
15341533

@@ -1821,13 +1820,8 @@ of a <var>node</var> into a <var>parent</var> before a
18211820
<li>If <var>child</var> is not null and its <a>parent</a> is not <var>parent</var>, then
18221821
<a>throw</a> a {{NotFoundError}}.
18231822

1824-
<li>If <var>node</var> is not a
1825-
{{DocumentFragment}}, {{DocumentType}},
1826-
{{Element}}, {{Text}},
1827-
{{ProcessingInstruction}}, or {{Comment}}
1828-
<a>node</a>,
1829-
<a>throw</a> a
1830-
{{HierarchyRequestError}}.
1823+
<li>If <var>node</var> is not a {{DocumentFragment}}, {{DocumentType}}, {{Element}}, or
1824+
{{CharacterData}} <a>node</a>, <a>throw</a> a {{HierarchyRequestError}}.
18311825

18321826
<li>If either <var>node</var> is a {{Text}}
18331827
<a>node</a> and <var>parent</var> is a
@@ -1839,7 +1833,7 @@ of a <var>node</var> into a <var>parent</var> before a
18391833

18401834
<li>
18411835
If <var>parent</var> is a
1842-
<a>document</a>, and any of the statements below, switched
1836+
<a>document</a>, and any of the statements below, depending
18431837
on <var>node</var>, are true, <a>throw</a> a
18441838
{{HierarchyRequestError}}.
18451839

@@ -2041,13 +2035,8 @@ steps:
20412035
<li>If <var>child</var>'s <a>parent</a> is not <var>parent</var>, then <a>throw</a> a
20422036
{{NotFoundError}}.
20432037

2044-
<li>If <var>node</var> is not a
2045-
{{DocumentFragment}}, {{DocumentType}},
2046-
{{Element}}, {{Text}},
2047-
{{ProcessingInstruction}}, or {{Comment}}
2048-
<a>node</a>,
2049-
<a>throw</a> a
2050-
{{HierarchyRequestError}}.
2038+
<li>If <var>node</var> is not a {{DocumentFragment}}, {{DocumentType}}, {{Element}}, or
2039+
{{CharacterData}} <a>node</a>, <a>throw</a> a {{HierarchyRequestError}}.
20512040

20522041
<li>If either <var>node</var> is a {{Text}}
20532042
<a>node</a> and <var>parent</var> is a
@@ -2059,7 +2048,7 @@ steps:
20592048

20602049
<li>
20612050
If <var>parent</var> is a
2062-
<a>document</a>, and any of the statements below, switched
2051+
<a>document</a>, and any of the statements below, depending
20632052
on <var>node</var>, are true, <a>throw</a> a
20642053
{{HierarchyRequestError}}.
20652054

@@ -3460,7 +3449,7 @@ dictionary GetRootNodeOptions {
34603449

34613450
<p class="note no-backref">{{Node}} is an abstract interface and does not exist as <a>node</a>. It
34623451
is used by all <a>nodes</a> ({{Document}}, {{DocumentType}}, {{DocumentFragment}}, {{Element}},
3463-
{{Text}}, {{ProcessingInstruction}}, and {{Comment}}).
3452+
{{Text}}, {{CDATASection}}, {{ProcessingInstruction}}, and {{Comment}}).
34643453

34653454
Each <a>node</a> has an associated
34663455
<dfn export for=Node id=concept-node-document>node document</dfn>, set upon creation,
@@ -3524,6 +3513,9 @@ that is a <a>document</a>.
35243513
<dt>{{Text}}
35253514
<dd>"<code>#text</code>".
35263515

3516+
<dt>{{CDATASection}}
3517+
<dd>"<code>#cdata-section</code>".
3518+
35273519
<dt>{{ProcessingInstruction}}
35283520
<dd>Its <a for=ProcessingInstruction>target</a>.
35293521

@@ -3542,7 +3534,7 @@ that is a <a>document</a>.
35423534
</dl>
35433535

35443536
The <dfn attribute for=Node>nodeType</dfn> attribute's getter, when invoked, must return
3545-
the first matching statement, switching on the <a>context object</a>:
3537+
the first matching statement, depending on the <a>context object</a>:
35463538

35473539
<dl class=switch>
35483540
<dt>{{Element}}
@@ -3603,7 +3595,7 @@ must return the local name that is associated with the node, if it has one,
36033595
and null otherwise.-->
36043596

36053597
The <dfn attribute for=Node>nodeName</dfn> attribute's getter, when invoked, must return
3606-
the first matching statement, switching on the <a>context object</a>:
3598+
the first matching statement, depending on the <a>context object</a>:
36073599

36083600
<dl class=switch>
36093601
<dt>{{Element}}
@@ -3619,6 +3611,9 @@ the first matching statement, switching on the <a>context object</a>:
36193611
<dt>{{Text}}
36203612
<dd>"<code>#text</code>".
36213613

3614+
<dt>{{CDATASection}}
3615+
<dd>"<code>#cdata-section</code>".
3616+
36223617
<dt>{{ProcessingInstruction}}
36233618
<dd>Its <a for=ProcessingInstruction>target</a>.
36243619

@@ -3750,9 +3745,7 @@ must return the following, depending on the <a>context object</a>:
37503745

37513746
<dl class=switch>
37523747
<!--AttrExodus <dt>{{Attr}} -->
3753-
<dt>{{Text}}
3754-
<dt>{{ProcessingInstruction}}
3755-
<dt>{{Comment}}
3748+
<dt>{{CharacterData}}
37563749
<dd>The <a>context object</a>'s
37573750
<a>data</a>.
37583751

@@ -3766,9 +3759,7 @@ instead, and then do as described below, depending on the <a>context object</a>:
37663759

37673760
<dl class=switch>
37683761
<!--AttrExodus <dt>{{Attr}} -->
3769-
<dt>{{Text}}
3770-
<dt>{{ProcessingInstruction}}
3771-
<dt>{{Comment}}
3762+
<dt>{{CharacterData}}
37723763
<dd><a>Replace data</a> with node
37733764
<a>context object</a>, offset 0, count
37743765
{{CharacterData/length}} attribute value, and
@@ -3779,7 +3770,7 @@ instead, and then do as described below, depending on the <a>context object</a>:
37793770
</dl>
37803771

37813772
<p>The <dfn attribute for=Node><code>textContent</code></dfn> attribute's getter must return the
3782-
following, switching on <a>context object</a>:
3773+
following, depending on the <a>context object</a>:
37833774

37843775
<dl class=switch>
37853776
<dt>{{DocumentFragment}}
@@ -3791,9 +3782,7 @@ following, switching on <a>context object</a>:
37913782
<a>context object</a>, in
37923783
<a>tree order</a>.
37933784

3794-
<dt>{{Text}}
3795-
<dt>{{ProcessingInstruction}}
3796-
<dt>{{Comment}}
3785+
<dt>{{CharacterData}}
37973786
<dd>The <a>context object</a>'s
37983787
<a>data</a>.
37993788

@@ -3802,7 +3791,7 @@ following, switching on <a>context object</a>:
38023791
</dl>
38033792

38043793
<p>The {{Node/textContent}} attribute's setter must, if the given value is null, act as if it was
3805-
the empty string instead, and then do as described below, switching on <a>context object</a>:
3794+
the empty string instead, and then do as described below, depending on the <a>context object</a>:
38063795

38073796
<dl class=switch>
38083797
<dt>{{DocumentFragment}}
@@ -3819,9 +3808,7 @@ the empty string instead, and then do as described below, switching on <a>contex
38193808
<li><p><a>Replace all</a> with <var>node</var> within the <a>context object</a>.
38203809
</ol>
38213810

3822-
<dt>{{Text}}
3823-
<dt>{{ProcessingInstruction}}
3824-
<dt>{{Comment}}
3811+
<dt>{{CharacterData}}
38253812
<dd><p><a>Replace data</a> with node <a>context object</a>, offset 0, count
38263813
{{CharacterData/length}} attribute value, and data the given value.
38273814

@@ -3993,7 +3980,7 @@ dom-Range-extractContents, dom-Range-cloneContents -->
39933980

39943981
<li>
39953982
<p>Otherwise, let <var>copy</var> be a <a>node</a> that implements the same interfaces as
3996-
<var>node</var>, and fulfills these additional requirements, switching on
3983+
<var>node</var>, and fulfills these additional requirements, depending on
39973984
<var>node</var>:
39983985

39993986
<dl class=switch>

0 commit comments

Comments
 (0)