Skip to content

Commit 49aa430

Browse files
committed
Add support for attribute validate steps before attribute mutation.
Allows for integrating with Trusted Types - see #789. Contains #805.
1 parent 91803ee commit 49aa430

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

dom.bs

+29-17
Original file line numberDiff line numberDiff line change
@@ -4229,7 +4229,9 @@ dom-Range-extractContents, dom-Range-cloneContents -->
42294229
<ol>
42304230
<li><p>Let <var>copyAttribute</var> be a <a>clone</a> of <var>attribute</var>.
42314231

4232-
<li><p><a lt="append an attribute">Append</a> <var>copyAttribute</var> to <var>copy</var>.
4232+
<li>
4233+
<p><a lt="append an attribute">Append</a> <var>copyAttribute</var> to <var>copy</var>
4234+
with <var>copyAttribute</var>'s <a for="Attr">value</a>.
42334235
</ol>
42344236
</li>
42354237
</ol>
@@ -6100,10 +6102,20 @@ its <a for=Element>attribute list</a> <a for=list>is empty</a>.
61006102
<a for=/>elements</a>. The algorithm is passed <var>element</var>, <var>localName</var>,
61016103
<var>oldValue</var>, <var>value</var>, and <var>namespace</var>.
61026104

6105+
<p>This and <a lt="other applicable specifications">other specifications</a> may define
6106+
<dfn export id=concept-element-attributes-validation-ext>attribute validation steps</dfn> for
6107+
<a for=/>elements</a>. The algorithm is passed <var>element</var>, <var>localName</var>,
6108+
<var>value</var>, and <var>namespace</var>.
6109+
61036110
<p>To <dfn noexport>handle attribute changes</dfn> for an <a>attribute</a> <var>attribute</var> with
61046111
<var>element</var>, <var>oldValue</var>, and <var>newValue</var>, run these steps:
61056112

61066113
<ol>
6114+
<li><p>Run the <a>attribute validation steps</a> with <var>element</var>,
6115+
<var>attribute</var>'s <a for=Attr>local name</a>, <var>newValue</var> and
6116+
<var>attribute</var>'s <a for=Attr>namespace</a>. If this throws an exception, then
6117+
rethrow the exception and abort further steps.
6118+
61076119
<li><p><a>Queue a mutation record</a> of "<code>attributes</code>" for <var>element</var> with
61086120
<var>attribute</var>'s <a for=Attr>local name</a>, <var>attribute</var>'s
61096121
<a for=Attr>namespace</a>, <var>oldValue</var>, « », « », null, and null.
@@ -6130,12 +6142,14 @@ its <a for=Element>attribute list</a> <a for=list>is empty</a>.
61306142
</ol>
61316143

61326144
<p>To <dfn export id=concept-element-attributes-append lt="append an attribute">append</dfn> an
6133-
<a>attribute</a> <var>attribute</var> to an <a for="/">element</a> <var>element</var>, run these
6134-
steps:
6145+
<a>attribute</a> <var>attribute</var> to an <a for="/">element</a> <var>element</var>
6146+
with a <var>value</var>, run these steps:
61356147

61366148
<ol>
61376149
<li><p><a>Handle attribute changes</a> for <var>attribute</var> with <var>element</var>, null, and
6138-
<var>attribute</var>'s <a for=Attr>value</a>.
6150+
<var>value</var>.
6151+
6152+
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>value</var>.
61396153

61406154
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
61416155
<a for=Element>attribute list</a>.
@@ -6234,7 +6248,8 @@ run these steps:
62346248
<li><p>If <var>oldAttr</var> is non-null, then <a lt="replace an attribute">replace</a>
62356249
<var>oldAttr</var> with <var>attr</var>.
62366250

6237-
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>.
6251+
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>
6252+
with <var>attr</var>'s <a for="Attr">value</a>.
62386253

62396254
<li><p>Return <var>oldAttr</var>.
62406255
</ol>
@@ -6254,10 +6269,9 @@ optional <var>prefix</var>, and <var>namespace</var>, run these steps:
62546269

62556270
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is
62566271
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6257-
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and
6258-
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then
6259-
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var>, and then
6260-
return.
6272+
<a for=Attr>local name</a> is <var>localName</var> and <a for=Node>node document</a> is
6273+
<var>element</var>'s <a for=Node>node document</a>, then <a lt="append an attribute">append</a>
6274+
this <a>attribute</a> to <var>element</var> with <var>value</var>, and then return.
62616275

62626276
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
62636277
</ol>
@@ -6520,10 +6534,9 @@ method, when invoked, must run these steps:
65206534
<!-- This is step 2 of "get an attribute by name", modified as appropriate -->
65216535

65226536
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
6523-
<a for="Attr">local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
6524-
<var>value</var>, and <a for=Node>node document</a> is <a>context object</a>'s
6525-
<a for=Node>node document</a>, then <a lt="append an attribute">append</a> this <a>attribute</a> to
6526-
<a>context object</a>, and then return.
6537+
<a for="Attr">local name</a> is <var>qualifiedName</var> and <a for=Node>node document</a>
6538+
is <a>context object</a>'s <a for=Node>node document</a>, then <a lt="append an attribute">append</a>
6539+
this <a>attribute</a> to <a>context object</a> with <var>value</var> and then return.
65276540

65286541
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
65296542
</ol>
@@ -6585,10 +6598,9 @@ method, when invoked, must run these steps:
65856598

65866599
<ol>
65876600
<li><p>If <var>force</var> is not given or is true, create an <a>attribute</a> whose
6588-
<a for="Attr">local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is the empty
6589-
string, and <a for=Node>node document</a> is the <a>context object</a>'s
6590-
<a for=Node>node document</a>, then <a lt="append an attribute">append</a> this <a>attribute</a>
6591-
to the <a>context object</a>, and then return true.
6601+
<a for="Attr">local name</a> is <var>qualifiedName</var> and <a for=Node>node document</a>
6602+
is the <a>context object</a>'s <a for=Node>node document</a>, then <a lt="append an attribute">append</a>
6603+
this <a>attribute</a> to the <a>context object</a> with an empty string, and then return true.
65926604

65936605
<li><p>Return false.
65946606
</ol>

0 commit comments

Comments
 (0)