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

@annevk commented on this pull request.



> +urlPrefix: https://w3c.github.io/trusted-types/dist/spec/#; spec: TRUSTED-TYPES
+ type:dfn; text: [[Data]]; for: TrustedScript; url: trustedscript-data

This shouldn't be needed? Also why is this using square brackets?

> +     <li><p>Let <var>text</var> be 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>",
+     "<code>script</code>".

Missing "and" in the argument list.

> +
+  <ol>
+   <li>
+    <p>If <var>value</var> is a <a for=/>node</a>, then:
+
+    <ol>
+     <li><p>If <var>isScriptElement</var> is false, then <a for=iteration>continue</a>.
+
+     <li><p>If <var>value</var> is not a {{Text}} <a for=/>node</a>, then <a for=iteration>continue</a>.
+
+     <li><p>Let <var>text</var> be 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>",
+     "<code>script</code>".
+
+     <li><p>Set <var>value</var>'s <a for=CharacterData>data</a> to <var>text</var>.

Why define _text_ if we use it once? I would inline this step into the one above.

> +    <p>If <var>value</var> is a <a for=/>node</a>, then:
+
+    <ol>
+     <li><p>If <var>isScriptElement</var> is false, then <a for=iteration>continue</a>.
+
+     <li><p>If <var>value</var> is not a {{Text}} <a for=/>node</a>, then <a for=iteration>continue</a>.
+
+     <li><p>Let <var>text</var> be 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>",
+     "<code>script</code>".
+
+     <li><p>Set <var>value</var>'s <a for=CharacterData>data</a> to <var>text</var>.
+    </ol>
+
+    <li>

This cannot have the same indentation level as `</ol>`.

> +
+     <li><p>Set <var>value</var>'s <a for=CharacterData>data</a> to <var>text</var>.
+    </ol>
+
+    <li>
+     <p>If <var>value</var> is a {{TrustedScript}}, then:
+
+     <ol>
+      <li><p>Let <var>text</var> be <var>value</var>'s <a for=TrustedScript>\[[Data]]</a>
+      internal slot value.
+
+      <li><p>Let <var>newValue</var> be a new {{Text}} <a for=/>node</a> whose
+      <a for=CharacterData>data</a> is <var>text</var> and <a for=Node>node document</a> is
+      <var>document</var>.
+
+      <li><p>Replace <var>value</var> with <var>newValue</var>.

"Replace" is not defined here. I guess you are attempting to modify _nodes_ directly? That makes me worried about https://github.com/whatwg/infra/pull/451.

> +
+  <ol>
+   <li>
+    <p>If <var>value</var> is a <a for=/>node</a>, then:
+
+    <ol>
+     <li><p>If <var>isScriptElement</var> is false, then <a for=iteration>continue</a>.
+
+     <li><p>If <var>value</var> is not a {{Text}} <a for=/>node</a>, then <a for=iteration>continue</a>.
+
+     <li><p>Let <var>text</var> be 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>",
+     "<code>script</code>".
+
+     <li><p>Set <var>value</var>'s <a for=CharacterData>data</a> to <var>text</var>.

In fact, would this work:

> If _value_ is a Text node and isScriptElement is true, then set _value_'s data to ...

?

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

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

Received on Monday, 15 April 2024 16:33:28 UTC