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 authored and lukewarlow committed Aug 13, 2024
1 parent 809bfa2 commit 184fbb3
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6133,8 +6133,8 @@ interface Element : Node {
sequence<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 @@ -6456,6 +6456,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 @@ -6469,6 +6473,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 @@ -6497,6 +6506,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 @@ -6583,7 +6597,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 @@ -6594,7 +6608,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 @@ -6862,7 +6876,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 184fbb3

Please sign in to comment.