Re: [whatwg/dom] Trusted types attributes (PR #1268)

@annevk commented on this pull request.



>   <li><p>Return <var>oldAttr</var>.
 </ol>
 </div>
 
 <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>,
-an optional null or string <var>prefix</var> (default null), and an optional null or string
-<var>namespace</var> (default null):
+<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an <a

No wrapping in phrasing-level elements.

>  
 <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; otherwise true.
+
+ <li><p>If <var>attributeExists</var> is false, set <var>attribute</var> to an <a>attribute</a>

then set

>  
 <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; otherwise true.
+
+ <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

No wrapping in phrasing

> - return.
+ <li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true.
+
+ <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>

"result of verifying an attribute" is nicer. And it should work with Bikeshed.

> @@ -6641,6 +6651,9 @@ string <var>namespace</var> (default null):</p>
 <a for=/>attribute</a> <var>attr</var> and an <a for=/>element</a> <var>element</var>:
 
 <ol>
+ <li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a>

"result of verifying an attribute value"

> @@ -6939,12 +6980,29 @@ 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; otherwise true.
+
+ <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>

"result of verifying"

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1268#pullrequestreview-2630464503
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1268/review/2630464503@github.com>

Received on Thursday, 20 February 2025 16:27:35 UTC