Skip to content

Commit 53fb898

Browse files
authored
Reinstate CDATASection
I’m thirty now so it’s time to face reality. This fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=27386.
1 parent 443023a commit 53fb898

File tree

2 files changed

+77
-27
lines changed

2 files changed

+77
-27
lines changed

dom.bs

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,7 +3400,7 @@ interface Node : EventTarget {
34003400
const unsigned short ELEMENT_NODE = 1;
34013401
const unsigned short ATTRIBUTE_NODE = 2; // historical
34023402
const unsigned short TEXT_NODE = 3;
3403-
const unsigned short CDATA_SECTION_NODE = 4; // historical
3403+
const unsigned short CDATA_SECTION_NODE = 4;
34043404
const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
34053405
const unsigned short ENTITY_NODE = 6; // historical
34063406
const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
@@ -3489,6 +3489,9 @@ that is a <a>document</a>.
34893489
<dd><var>node</var> is a {{Text}}
34903490
<a>node</a>.
34913491

3492+
<dt><code>{{Node}} . {{Node/CDATA_SECTION_NODE}}</code> (4)
3493+
<dd><var>node</var> is a {{CDATASection}} <a>node</a>.
3494+
34923495
<dt><code>{{Node}} . {{Node/PROCESSING_INSTRUCTION_NODE}}</code> (7)
34933496
<dd><var>node</var> is a {{ProcessingInstruction}}
34943497
<a>node</a>.
@@ -3553,9 +3556,8 @@ the first matching statement, switching on the <a>context object</a>:
35533556
<dt>{{Text}}
35543557
<dd><dfn const for=Node>TEXT_NODE</dfn> (3);
35553558

3556-
<!-- XXX CDATA
3557-
<dfn const for=Node>CDATA_SECTION_NODE</dfn> (4, historical);
3558-
-->
3559+
<dt>{{CDATASection}}
3560+
<dd><dfn const for=Node>CDATA_SECTION_NODE</dfn> (4);
35593561

35603562
<dt>{{ProcessingInstruction}}
35613563
<dd><dfn const for=Node>PROCESSING_INSTRUCTION_NODE</dfn> (7);
@@ -4546,6 +4548,7 @@ interface Document : Node {
45464548
[NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options);
45474549
[NewObject] DocumentFragment createDocumentFragment();
45484550
[NewObject] Text createTextNode(DOMString data);
4551+
[NewObject] CDATASection createCDATASection(DOMString data);
45494552
[NewObject] Comment createComment(DOMString data);
45504553
[NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
45514554

@@ -4868,6 +4871,9 @@ for the <a>context object</a>.
48684871
<dd>Returns a {{Text}} <a>node</a>
48694872
whose <a>data</a> is <var>data</var>.
48704873

4874+
<dt><code><var>text</var> = <var>document</var> . {{createCDATASection(data)}}</code>
4875+
<dd>Returns a {{CDATASection}} <a>node</a> whose <a>data</a> is <var>data</var>.
4876+
48714877
<dt><code><var>comment</var> = <var>document</var> . {{createComment(data)}}</code>
48724878
<dd>Returns a {{Comment}} <a>node</a>
48734879
whose <a>data</a> is <var>data</var>.
@@ -4974,6 +4980,20 @@ invoked, must return a new {{Text}} <a>node</a> with its <a>data</a> set to <var
49744980
<p class="note no-backref">No check is performed that <var>data</var> consists of
49754981
characters that match the <code><a type>Char</a></code> production.
49764982

4983+
<p>The <dfn method for=Document><code>createCDATASection(<var>data</var>)</code></dfn> method, when
4984+
invoked, must run these steps:
4985+
4986+
<ol>
4987+
<li><p>If <a>context object</a> is an <a>HTML document</a>, then <a>throw</a> a
4988+
{{NotSupportedError}}.
4989+
4990+
<li><p>If <var>data</var> contains the string "<code>]]></code>", then <a>throw</a> an
4991+
{{InvalidCharacterError}}.
4992+
4993+
<li><p>Return a new {{CDATASection}} <a>node</a> with its <a>data</a> set to <var>data</var> and
4994+
<a>node document</a> set to the <a>context object</a>.
4995+
</ol>
4996+
49774997
The <dfn method for=Document><code>createComment(<var>data</var>)</code></dfn> method, when invoked,
49784998
must return a new {{Comment}} <a>node</a> with its <a>data</a> set to <var>data</var> and
49794999
<a>node document</a> set to the <a>context object</a>.
@@ -7108,6 +7128,15 @@ attribute must return a concatenation of the
71087128

71097129

71107130

7131+
<h3 id=interface-cdatasection>Interface {{CDATASection}}</h3>
7132+
7133+
<pre class=idl>
7134+
[Exposed=Window]
7135+
interface CDATASection : Text {
7136+
};</pre>
7137+
7138+
7139+
71117140
<h3 id='interface-processinginstruction'>Interface {{ProcessingInstruction}}</h3>
71127141

71137142
<pre class=idl>
@@ -9315,7 +9344,7 @@ callback interface NodeFilter {
93159344
const unsigned long SHOW_ELEMENT = 0x1;
93169345
const unsigned long SHOW_ATTRIBUTE = 0x2; // historical
93179346
const unsigned long SHOW_TEXT = 0x4;
9318-
const unsigned long SHOW_CDATA_SECTION = 0x8; // historical
9347+
const unsigned long SHOW_CDATA_SECTION = 0x8;
93199348
const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical
93209349
const unsigned long SHOW_ENTITY = 0x20; // historical
93219350
const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40;
@@ -9354,9 +9383,7 @@ These constants can be used for the
93549383
<li><dfn const for="NodeFilter">SHOW_ATTRIBUTE</dfn> (2, historical);
93559384
-->
93569385
<li><dfn const for="NodeFilter">SHOW_TEXT</dfn> (4);
9357-
<!-- XXX still questionable
9358-
<li><dfn const for="NodeFilter">SHOW_CDATA_SECTION</dfn> (8; historical);
9359-
-->
9386+
<li><dfn const for="NodeFilter">SHOW_CDATA_SECTION</dfn> (8);
93609387
<li><dfn const for="NodeFilter">SHOW_PROCESSING_INSTRUCTION</dfn> (64, 40 in hexadecimal);
93619388
<li><dfn const for="NodeFilter">SHOW_COMMENT</dfn> (128, 80 in hexadecimal);
93629389
<li><dfn const for="NodeFilter">SHOW_DOCUMENT</dfn> (256, 100 in hexadecimal);
@@ -9706,7 +9733,6 @@ some of these features should be reintroduced.
97069733

97079734
Interfaces:
97089735
<ul class=brief dfn-type="interface">
9709-
<li><dfn><code>CDATASection</code></dfn>
97109736
<li><dfn><code>DOMConfiguration</code></dfn>
97119737
<li><dfn><code>DOMError</code></dfn>
97129738
<li><dfn><code>DOMErrorHandler</code></dfn>
@@ -9738,7 +9764,6 @@ Interface members:
97389764
<dt>{{Document}}
97399765
<dd>
97409766
<ul class=brief>
9741-
<li><dfn method for=Document>createCDATASection()</dfn>
97429767
<li><dfn method for=Document>createEntityReference()</dfn>
97439768
<li><dfn attribute for=Document>xmlEncoding</dfn>
97449769
<li><dfn attribute for=Document>xmlStandalone</dfn>

0 commit comments

Comments
 (0)