Skip to content

Commit 5bcc0af

Browse files
committed
Draft integration with Trusted Types, take 2.
See w3c/trusted-types#418 and whatwg#789. Supercedes PR whatwg#809.
1 parent 6a9b5a2 commit 5bcc0af

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

dom.bs

+21-6
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ spec:html; type:element
5252
<p>This specification depends on the Infra Standard. [[!INFRA]]
5353

5454
<p>Some of the terms used in this specification are defined in <cite>Encoding</cite>,
55-
<cite>Selectors</cite>, <cite>Web IDL</cite>, <cite>XML</cite>, and <cite>Namespaces in XML</cite>.
55+
<cite>Selectors</cite>, <cite>Trusted Types</cite>, <cite>Web IDL</cite>, <cite>XML</cite>, and <cite>Namespaces in XML</cite>.
5656
[[!ENCODING]]
5757
[[!SELECTORS4]]
58+
[[!TRUSTED-TYPES]]
5859
[[!WEBIDL]]
5960
[[!XML]]
6061
[[!XML-NAMES]]
@@ -6033,8 +6034,8 @@ interface Element : Node {
60336034
sequence&lt;DOMString> getAttributeNames();
60346035
DOMString? getAttribute(DOMString qualifiedName);
60356036
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
6036-
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
6037-
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
6037+
[CEReactions] undefined setAttribute(DOMString qualifiedName, (TrustedType or DOMString) value);
6038+
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, (TrustedType or DOMString) value);
60386039
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
60396040
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
60406041
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
@@ -6355,6 +6356,10 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63556356
<a>attribute</a> <var>attribute</var> to <var>value</var>, run these steps:
63566357

63576358
<ol>
6359+
<li><p>Set <var>value</var> to the result of calling <a>Get Trusted Types-compliant attribute
6360+
value</a> for <var>attribute</var>, with <var>attribute</var>'s <a for=Attr>element</a> and
6361+
<var>value</var>. [[!TRUSTED-TYPES]]
6362+
63586363
<li><p>Let <var>oldValue</var> be <var>attribute</var>'s <a for=Attr>value</a>.</p></li>
63596364

63606365
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>value</var>.
@@ -6368,6 +6373,11 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63686373
steps:
63696374

63706375
<ol>
6376+
<li><p>Set <var>attribute</var>'s
6377+
<a for=Attr>value</a> to the result of calling <a>Get Trusted Types-compliant attribute value</a>
6378+
for <var>attribute</var>, with <var>element</var> and <var>attribute</var>'s <a for=Attr>value</a>.
6379+
[[!TRUSTED-TYPES]]
6380+
63716381
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
63726382
<a for=Element>attribute list</a>.
63736383

@@ -6396,6 +6406,11 @@ steps:
63966406
<a>attribute</a> <var>oldAttr</var> with an <a>attribute</a> <var>newAttr</var>, run these steps:
63976407

63986408
<ol>
6409+
<li><p>Set <var>newAttr</var>'s
6410+
<a for=Attr>value</a> to the result of calling <a>Get Trusted Types-compliant attribute value</a>
6411+
for <var>newAttr</var>, with <var>oldAttr</var>'s <a for=Attr>element</a> and <var>newAttr</var>'s
6412+
<a for=Attr>value</a>.[[!TRUSTED-TYPES]]
6413+
63996414
<li><p><a for=list>Replace</a> <var>oldAttr</var> by <var>newAttr</var> in <var>oldAttr</var>'s
64006415
<a for=Attr>element</a>'s <a for=Element>attribute list</a>.
64016416

@@ -6482,7 +6497,7 @@ string <var>namespace</var> (default null):</p>
64826497

64836498
<div algorithm>
64846499
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an
6485-
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string <var>value</var>,
6500+
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string or <a>TrustedType</a> <var>value</var>,
64866501
an optional null or string <var>prefix</var> (default null), and an optional null or string
64876502
<var>namespace</var> (default null):
64886503

@@ -6493,7 +6508,7 @@ an optional null or string <var>prefix</var> (default null), and an optional nul
64936508

64946509
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is
64956510
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6496-
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and
6511+
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is stringified <var>value</var>, and
64976512
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then
64986513
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var>, and then
64996514
return.
@@ -6761,7 +6776,7 @@ method steps are:
67616776

67626777
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
67636778
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
6764-
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
6779+
stringified <var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
67656780
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return.
67666781

67676782
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.

0 commit comments

Comments
 (0)