Skip to content

Commit

Permalink
Update how the enforcement is done
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed May 16, 2024
1 parent 0f0ed54 commit 4089eaf
Showing 1 changed file with 60 additions and 41 deletions.
101 changes: 60 additions & 41 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6406,33 +6406,17 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
<ol>
<li><p>Let <var>oldValue</var> be <var>attribute</var>'s <a for=Attr>value</a>.</p></li>

<li><p><a>Verify and set attribute value</a> <var>value</var> for <var>attribute</var>, with
<var>attribute</var>'s <a for=Attr>element</a>.
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>value</var>.

<li><p>If <var>attribute</var>'s <a for=Attr>element</a>
<a lt="has an attribute">has an attribute</a>, then <a>handle attribute changes</a> for
<var>attribute</var> with <var>attribute</var>'s <a for=Attr>element</a>, <var>oldValue</var>, and
<var>value</var>.

<li><p>Otherwise, throw an "{{InvalidStateError!!exception}}" {{DOMException}}.
<li><p><a>Handle attribute changes</a> for <var>attribute</var> with <var>attribute</var>'s
<a for=Attr>element</a>, <var>oldValue</var>, and <var>value</var>.
</ol>

<p>To <dfn export id=concept-element-attributes-append lt="append an attribute">append</dfn> an
<a>attribute</a> <var>attribute</var> to an <a for=/>element</a> <var>element</var>, with an
optional boolean <var>validate</var> (default true):
<a>attribute</a> <var>attribute</var> to an <a for=/>element</a> <var>element</var>, run these
steps:

<ol>
<li>
<p>If <var>validate</var> is true:

<ol>
<li><p><a>Verify and set attribute value</a>
<var>attribute</var>'s <a for="Attr">value</a> for <var>attribute</var>, with <var>element</var>.

<li><p>If <var>element</var> <a lt="has an attribute">has</a> an <a>attribute</a>
<var>attribute</var>, then throw an "{{InvalidStateError!!exception}}" {{DOMException}}.
</ol>

<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 @@ -6461,9 +6445,6 @@ optional boolean <var>validate</var> (default true):
<a>attribute</a> <var>oldAttr</var> with an <a>attribute</a> <var>newAttr</var>, run these steps:

<ol>
<li><p><a>Verify and set attribute value</a> <var>newAttr</var>'s <a for="Attr">value</a> for
<var>newAttr</var>, with <var>oldAttr</var>'s <a for=Attr>element</a>.

<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 All @@ -6477,16 +6458,14 @@ optional boolean <var>validate</var> (default true):
<a for=Attr>value</a>.
</ol>

<p>To <dfn>verify and set attribute value</dfn>
<p>To <dfn>verify attribute value</dfn>
{{TrustedType}} or string <var>value</var> for an <a>attribute</a> <var>attribute</var>, given an
<a for=/>Element</a> <var>element</var>:

<ol>
<li><p>Let <var>verifiedValue</var> be the result of calling
<li><p>Return the result of calling
<a abstract-op>get Trusted Types-compliant attribute value</a> for <var>attribute</var>, with
<var>element</var>, <var>value</var>. [[!TRUSTED-TYPES]]

<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>.
</ol>

<hr>
Expand Down Expand Up @@ -6551,6 +6530,11 @@ string <var>namespace</var> (default null):</p>

<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.

<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a>
<var>attr</var>'s <a for=Attr>value</a> for <var>attr</var>, with <var>element</var>.

<li><p>Set <var>attr</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>.

<li><p>If <var>oldAttr</var> is non-null, then <a lt="replace an attribute">replace</a>
<var>oldAttr</var> with <var>attr</var>.

Expand All @@ -6571,14 +6555,30 @@ or string <var>namespace</var> (default null):
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
<var>namespace</var>, <var>localName</var>, and <var>element</var>.

<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=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.
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null, and true otherwise.

<li><p>If <var>attributeExists</var> is false, set <var>attribute</var> to 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=Node>node document</a> is <var>element</var>'s <a for=Node>node
document</a>.

<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a>
<var>value</var> for <var>attribute</var>, with <var>element</var>.

<li><p>Set <var>attributeExists</var> to true if <var>element</var> <a lt="has an attribute">has
an attribute</a> <var>attribute</var>; otherwise false.

<li><p>If <var>attributeExists</var> is true, <a lt="change an attribute">change</a>
<var>attribute</var> to <var>verifiedValue</var>.

<li><p>Otherwise:
<ol>
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>.

<li><p><a lt="append an attribute">Append</a> this <a>attribute</a> to
<var>element</var>.
</ol>
</ol>
</div>

Expand Down Expand Up @@ -6839,12 +6839,25 @@ method steps are:
and null otherwise.
<!-- This is step 2 of "get an attribute by name", modified as appropriate -->

<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>,
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return.
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null, and true otherwise.

<li><p>If <var>attributeExists</var> is false, set <var>attribute</var> to 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>.

<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a>
<var>value</var> for <var>attribute</var>, with <a>this</a>.

<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>.

<li><p>Set <var>attributeExists</var> to true if <a>this</a> <a lt="has an attribute">has an
attribute</a> <var>attribute</var>; otherwise false.

<li><p>If <var>attributeExists</var> is true, <a lt="change an attribute">change</a>
<var>attribute</var> to <var>value</var>.

<li><p>Otherwise <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>.
</ol>

<p>The
Expand Down Expand Up @@ -7414,7 +7427,13 @@ string <var>value</var>, run these steps:
<li><p>If <var>attribute</var>'s <a for=Attr>element</a> is null, then set <var>attribute</var>'s
<a for=Attr>value</a> to <var>value</var>.

<li><p>Otherwise, <a lt="change an attribute">change</a> <var>attribute</var> to <var>value</var>.
<li><p>Otherwise:
<ol>
<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a>
<var>value</var> for <var>attribute</var>, with <a>this</a>.

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

<p>The {{Attr/value}} setter steps are to <a>set an existing attribute value</a> with <a>this</a>
Expand Down

0 comments on commit 4089eaf

Please sign in to comment.