Re: [whatwg/dom] Integration with trusted types inside of node conversion (PR #1258)

@annevk commented on this pull request.



> @@ -3040,6 +3042,39 @@ standards that want to define APIs shared between <a for=/>documents</a> and
  <a for=CharacterData>data</a> is the string and <a for=Node>node document</a> is
  <var>document</var>.
 
+ <li><p>Let <var>isScriptElement</var> be true if <var>parent</var> is an {{HTMLScriptElement}}
+ <a for=/>node</a>; otherwise false.
+
+ <li>
+  <p><a for=set>For each</a> <var>value</var> of <var>nodes</var>:
+
+  <ol>
+   <li>
+    <p>If <var>value</var> is a <a for=/>node</a>, then:

This check is redundant with the "If value is a Text node" I think. In particular because there's no Otherwise clause below.

> +  <p><a for=set>For each</a> <var>value</var> of <var>nodes</var>:
+
+  <ol>
+   <li>
+    <p>If <var>value</var> is a <a for=/>node</a>, then:
+
+    <ol>
+     <li><p>If <var>value</var> is a {{Text}} <a for=/>node</a>, and <var>isScriptElement</var>
+     is false, then set <var>value</var>'s <a for=CharacterData>data</a> to <var>text</var> the
+     result of calling <a abstract-op>Get Trusted Type compliant string</a>, with {{TrustedScript}},
+     <var>document</var>'s <a>relevant global object</a>, <var>value</var>'s
+     <a for=CharacterData>data</a>, "<code>HTMLScriptElement text</code>", and "<code>script</code>".
+    </ol>
+
+   <li>
+    <p>If <var>value</var> is a {{TrustedScript}}, then:

We don't write out "then" anymore if it's at the end of a paragraph.
```suggestion
    <p>If <var>value</var> is a {{TrustedScript}}:
```

> @@ -3040,6 +3042,39 @@ standards that want to define APIs shared between <a for=/>documents</a> and
  <a for=CharacterData>data</a> is the string and <a for=Node>node document</a> is
  <var>document</var>.
 
+ <li><p>Let <var>isScriptElement</var> be true if <var>parent</var> is an {{HTMLScriptElement}}
+ <a for=/>node</a>; otherwise false.
+
+ <li>
+  <p><a for=set>For each</a> <var>value</var> of <var>nodes</var>:
+
+  <ol>
+   <li>
+    <p>If <var>value</var> is a <a for=/>node</a>, then:
+
+    <ol>
+     <li><p>If <var>value</var> is a {{Text}} <a for=/>node</a>, and <var>isScriptElement</var>
+     is false, then set <var>value</var>'s <a for=CharacterData>data</a> to <var>text</var> the

It has to be true, right? (For a moment I thought my suggestion was wrong, but I did write true.)

> +     <li><p>Let <var>text</var> be <var>value</var>'s <a for=TrustedScript>\[[Data]]</a>
+     internal slot value.

I'd prefer this not using internal slot syntax. You're correct that HTML has used internal slot syntax for some things that sit close to ECMAScript, but if we were to do that today I don't think we would use that syntax.

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

Message ID: <whatwg/dom/pull/1258/review/2002596650@github.com>

Received on Tuesday, 16 April 2024 05:26:10 UTC