- From: Anne van Kesteren <notifications@github.com>
- Date: Thu, 20 Feb 2025 07:43:02 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1268/review/2630297005@github.com>
@annevk commented on this pull request.
I did a quick editorial review. Please double check the comments throughout as some apply several times.
> @@ -6589,6 +6591,14 @@ steps:
<a for=Attr>value</a>.
</ol>
+<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>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]]
```suggestion
for <var>attribute</var>, with <var>element</var> and <var>value</var>. [[!TRUSTED-TYPES]]
```
Although maybe we can use the more standard "given attribute, element, and value"?
> + <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>.
```suggestion
<li><p>Let <var>verifiedValue</var> be the result of <a>verifying attribute value</a> given
<var>attr</var>'s <a for=Attr>value</a>, <var>attr</var>, and <var>element</var>.
```
However, this doesn't match the signature above. What gives?
>
<ol>
<li>Let <var>attribute</var> be the result of
<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.
```suggestion
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true.
```
> - <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>Let <var>verifiedValue</var> be <var>value</var>.
+
+ <li><p>If <var>verify</var> is true:
`<p>` on its own line if the `<li>` has multiple children.
>
- <li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
+ <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:
`<p>` on its own line as `<li>` has multiple children.
> + <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>Let <var>verifiedValue</var> be <var>value</var>.
+
+ <li><p>If <var>verify</var> is true:
+ <ol>
+ <li><p>Set <var>verifiedValue</var> to 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
No newlines in phrasing level elements.
> @@ -6939,12 +6976,27 @@ 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.
```suggestion
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true.
```
> @@ -7514,7 +7566,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>
Single-space indentation.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1268#pullrequestreview-2630297005
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/pull/1268/review/2630297005@github.com>
Received on Thursday, 20 February 2025 15:43:06 UTC