Skip to content

Commit

Permalink
Draft integration with Trusted Types, take 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
koto committed Feb 26, 2024
1 parent 6a9b5a2 commit 5bcc0af
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ spec:html; type:element
<p>This specification depends on the Infra Standard. [[!INFRA]]

<p>Some of the terms used in this specification are defined in <cite>Encoding</cite>,
<cite>Selectors</cite>, <cite>Web IDL</cite>, <cite>XML</cite>, and <cite>Namespaces in XML</cite>.
<cite>Selectors</cite>, <cite>Trusted Types</cite>, <cite>Web IDL</cite>, <cite>XML</cite>, and <cite>Namespaces in XML</cite>.
[[!ENCODING]]
[[!SELECTORS4]]
[[!TRUSTED-TYPES]]
[[!WEBIDL]]
[[!XML]]
[[!XML-NAMES]]
Expand Down Expand Up @@ -6033,8 +6034,8 @@ interface Element : Node {
sequence&lt;DOMString> getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttribute(DOMString qualifiedName, (TrustedType or DOMString) value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, (TrustedType or DOMString) value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
Expand Down Expand Up @@ -6355,6 +6356,10 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
<a>attribute</a> <var>attribute</var> to <var>value</var>, run these steps:

<ol>
<li><p>Set <var>value</var> to the result of calling <a>Get Trusted Types-compliant attribute
value</a> for <var>attribute</var>, with <var>attribute</var>'s <a for=Attr>element</a> and
<var>value</var>. [[!TRUSTED-TYPES]]

<li><p>Let <var>oldValue</var> be <var>attribute</var>'s <a for=Attr>value</a>.</p></li>

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

<ol>
<li><p>Set <var>attribute</var>'s
<a for=Attr>value</a> to the result of calling <a>Get Trusted Types-compliant attribute value</a>
for <var>attribute</var>, with <var>element</var> and <var>attribute</var>'s <a for=Attr>value</a>.
[[!TRUSTED-TYPES]]

<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
<a for=Element>attribute list</a>.

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

<ol>
<li><p>Set <var>newAttr</var>'s
<a for=Attr>value</a> to the result of calling <a>Get Trusted Types-compliant attribute value</a>
for <var>newAttr</var>, with <var>oldAttr</var>'s <a for=Attr>element</a> and <var>newAttr</var>'s
<a for=Attr>value</a>.[[!TRUSTED-TYPES]]

<li><p><a for=list>Replace</a> <var>oldAttr</var> by <var>newAttr</var> in <var>oldAttr</var>'s
<a for=Attr>element</a>'s <a for=Element>attribute list</a>.

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

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

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

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

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

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

0 comments on commit 5bcc0af

Please sign in to comment.