Skip to content

Commit 69967de

Browse files
committed
Update spec for setAttribute and setAttributeNS to correctly account for the attribute identity changing from the default policy.
1 parent fe27a1d commit 69967de

File tree

1 file changed

+29
-48
lines changed

1 file changed

+29
-48
lines changed

dom.bs

Lines changed: 29 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6678,50 +6678,37 @@ string <var>namespace</var> (default null):</p>
66786678

66796679
<div algorithm>
66806680
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an
6681-
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string or {{TrustedType}}
6682-
<var>value</var>, an optional null or string <var>prefix</var> (default null), an optional null or
6683-
string <var>namespace</var> (default null), and an optional boolean <var>verify</var> (default
6684-
false):
6681+
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string <var>value</var>,
6682+
an optional null or string <var>prefix</var> (default null), and an optional null or string
6683+
<var>namespace</var> (default null):
66856684

66866685
<ol>
6687-
<li>Let <var>attribute</var> be the result of
6686+
<li><p>Let <var>attribute</var> be the result of
66886687
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
66896688
<var>namespace</var>, <var>localName</var>, and <var>element</var>.
66906689

6691-
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true.
6692-
6693-
<li><p>If <var>attributeExists</var> is false, then set <var>attribute</var> to an <a>attribute</a>
6694-
whose <a for=Attr>namespace</a> is <var>namespace</var>, <a for=Attr>namespace prefix</a> is
6690+
<li><p>If <var>attribute</var> is null, then set attribute to an <a>attribute</a> whose
6691+
<a for=Attr>namespace</a> is <var>namespace</var>, <a for=Attr>namespace prefix</a> is
66956692
<var>prefix</var>, <a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is
66966693
<var>value</var>, and <a for=Node>node document</a> is <var>element</var>'s
66976694
<a for=Node>node document</a>.
66986695

6699-
<li><p>Let <var>verifiedValue</var> be <var>value</var>.
6700-
6701-
<li>
6702-
<p>If <var>verify</var> is true:
6703-
6704-
<ol>
6705-
<li><p>Set <var>verifiedValue</var> to the result of
6706-
<a lt="verify attribute value">verifying an attribute value</a> given <var>value</var>,
6707-
<var>attribute</var>, and <var>element</var>.
6708-
6709-
<li><p>Set <var>attributeExists</var> to true if <var>element</var>
6710-
<a lt="has an attribute">has an attribute</a> <var>attribute</var>; otherwise false.
6711-
</ol>
6712-
</li>
6713-
6714-
<li><p>If <var>attributeExists</var> is true, <a lt="change an attribute">change</a>
6715-
<var>attribute</var> to <var>verifiedValue</var>.
6696+
<li><p>Let <var>verifiedValue</var> be the result of
6697+
<a lt="verify attribute value">verifying an attribute value</a> given <var>value</var>,
6698+
<var>attribute</var>, and <var>element</var>.
67166699

6717-
<li>
6718-
<p>Otherwise:
6700+
<li><p>Set <var>attribute</var> to the result of
6701+
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
6702+
<var>namespace</var>, <var>localName</var>, and <var>element</var>.
67196703

6720-
<ol>
6721-
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>.
6704+
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a>
6705+
is <var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6706+
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is
6707+
<var>verifiedValue</var>, and <a for=Node>node document</a> is <var>element</var>'s
6708+
<a for=Node>node document</a>, then <a lt="append an attribute">append</a> this <a>attribute</a> to
6709+
<var>element</var>, and then return.
67226710

6723-
<li><p><a lt="append an attribute">Append</a> this <a>attribute</a> to <var>element</var>.
6724-
</ol>
6711+
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>verifiedValue</var>.
67256712
</ol>
67266713
</div>
67276714

@@ -6980,32 +6967,26 @@ method steps are:
69806967
<li><p>Let <var>attribute</var> be the first <a>attribute</a> in <a>this</a>'s
69816968
<a for=Element>attribute list</a> whose <a for=Attr>qualified name</a> is <var>qualifiedName</var>,
69826969
and null otherwise.
6983-
<!-- This is step 2 of "get an attribute by name", modified as appropriate -->
6984-
6985-
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true.
69866970

6987-
<li><p>If <var>attributeExists</var> is false, then set <var>attribute</var> to an <a>attribute</a>
6971+
<li><p>If <var>attribute</var> is null, then set <var>attribute</var> to an <a>attribute</a>
69886972
whose <a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
69896973
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>.
69906974

69916975
<li><p>Let <var>verifiedValue</var> be the result of
69926976
<a lt="verify attribute value">verifying an attribute value</a> given <var>value</var>,
69936977
<var>attribute</var>, and <a>this</a>.
69946978

6995-
<li><p>Set <var>attributeExists</var> to true if <a>this</a>
6996-
<a lt="has an attribute">has an attribute</a> <var>attribute</var>; otherwise false.
6997-
6998-
<li><p>If <var>attributeExists</var> is true, <a lt="change an attribute">change</a>
6999-
<var>attribute</var> to <var>verifiedValue</var>.
7000-
7001-
<li>
7002-
<p>Otherwise:
6979+
<li><p>Set <var>attribute</var> to the first <a>attribute</a> in <a>this</a>'s
6980+
<a for=Element>attribute list</a> whose <a for=Attr>qualified name</a> is <var>qualifiedName</var>,
6981+
and null otherwise.
70036982

7004-
<ol>
7005-
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>.
6983+
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
6984+
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
6985+
<var>verifiedValue</var>, and <a for=Node>node document</a> is <a>this</a>'s
6986+
<a for=Node>node document</a>, then <a lt="append an attribute">append</a> this <a>attribute</a>
6987+
to <a>this</a>, and then return.
70066988

7007-
<li><p><a lt="append an attribute">Append</a> this <a>attribute</a> to <var>element</var>.
7008-
</ol>
6989+
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>verifiedValue</var>.
70096990
</ol>
70106991

70116992
<p>The

0 commit comments

Comments
 (0)