Skip to content

Commit 321883a

Browse files
kotolukewarlow
authored andcommitted
Draft integration with Trusted Types, take 2.
See w3c/trusted-types#418 and whatwg#789. Supercedes PR whatwg#809.
1 parent 77cd75e commit 321883a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

dom.bs

Lines changed: 21 additions & 6 deletions
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]]
@@ -6048,8 +6049,8 @@ interface Element : Node {
60486049
sequence&lt;DOMString> getAttributeNames();
60496050
DOMString? getAttribute(DOMString qualifiedName);
60506051
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
6051-
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
6052-
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
6052+
[CEReactions] undefined setAttribute(DOMString qualifiedName, (TrustedType or DOMString) value);
6053+
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, (TrustedType or DOMString) value);
60536054
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
60546055
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
60556056
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
@@ -6371,6 +6372,10 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63716372
<a>attribute</a> <var>attribute</var> to <var>value</var>, run these steps:
63726373

63736374
<ol>
6375+
<li><p>Set <var>value</var> to the result of calling <a>Get Trusted Types-compliant attribute
6376+
value</a> for <var>attribute</var>, with <var>attribute</var>'s <a for=Attr>element</a> and
6377+
<var>value</var>. [[!TRUSTED-TYPES]]
6378+
63746379
<li><p>Let <var>oldValue</var> be <var>attribute</var>'s <a for=Attr>value</a>.</p></li>
63756380

63766381
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>value</var>.
@@ -6384,6 +6389,11 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63846389
steps:
63856390

63866391
<ol>
6392+
<li><p>Set <var>attribute</var>'s
6393+
<a for=Attr>value</a> to the result of calling <a>Get Trusted Types-compliant attribute value</a>
6394+
for <var>attribute</var>, with <var>element</var> and <var>attribute</var>'s <a for=Attr>value</a>.
6395+
[[!TRUSTED-TYPES]]
6396+
63876397
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
63886398
<a for=Element>attribute list</a>.
63896399

@@ -6412,6 +6422,11 @@ steps:
64126422
<a>attribute</a> <var>oldAttr</var> with an <a>attribute</a> <var>newAttr</var>, run these steps:
64136423

64146424
<ol>
6425+
<li><p>Set <var>newAttr</var>'s
6426+
<a for=Attr>value</a> to the result of calling <a>Get Trusted Types-compliant attribute value</a>
6427+
for <var>newAttr</var>, with <var>oldAttr</var>'s <a for=Attr>element</a> and <var>newAttr</var>'s
6428+
<a for=Attr>value</a>.[[!TRUSTED-TYPES]]
6429+
64156430
<li><p><a for=list>Replace</a> <var>oldAttr</var> by <var>newAttr</var> in <var>oldAttr</var>'s
64166431
<a for=Attr>element</a>'s <a for=Element>attribute list</a>.
64176432

@@ -6498,7 +6513,7 @@ string <var>namespace</var> (default null):</p>
64986513

64996514
<div algorithm>
65006515
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an
6501-
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string <var>value</var>,
6516+
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string or <a>TrustedType</a> <var>value</var>,
65026517
an optional null or string <var>prefix</var> (default null), and an optional null or string
65036518
<var>namespace</var> (default null):
65046519

@@ -6509,7 +6524,7 @@ an optional null or string <var>prefix</var> (default null), and an optional nul
65096524

65106525
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is
65116526
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6512-
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and
6527+
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is stringified <var>value</var>, and
65136528
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then
65146529
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var>, and then
65156530
return.
@@ -6777,7 +6792,7 @@ method steps are:
67776792

67786793
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
67796794
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
6780-
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
6795+
stringified <var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
67816796
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return.
67826797

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

0 commit comments

Comments
 (0)