Skip to content

Commit a60ba8f

Browse files
authored
Add initial SVGScriptElement handling to the spec (#581)
1 parent 0cc17c1 commit a60ba8f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

spec/index.bs

+13-5
Original file line numberDiff line numberDiff line change
@@ -1069,14 +1069,16 @@ Given a {{TrustedType}} type (|expectedType|), a [=realm/global object=] (|globa
10691069

10701070
## <dfn abstract-op>Prepare the script text</dfn> ## {#prepare-script-text}
10711071

1072-
Given an {{HTMLScriptElement}} (|script|), this algorithm performs the following steps:
1072+
Given an {{HTMLScriptElement}} or {{SVGScriptElement}} (|script|), this algorithm performs the following steps:
1073+
1074+
1. Let |sink| be "`HTMLScriptElement text`" if |script| is an {{HTMLScriptElement}}; otherwise "`SVGScriptElement text`".
10731075

10741076
1. If |script|'s [=script text=] value is not equal to its [=child text content=],
10751077
set |script|'s [=script text=] to the result of executing [$Get Trusted Type compliant string$], with the following arguments:
10761078
* {{TrustedScriptURL}} as |expectedType|,
10771079
* |script|'s {{Document}}'s [=relevant global object=] as |global|,
10781080
* |script|'s [=child text content=] attribute value,
1079-
* `HTMLScriptElement text` as |sink|,
1081+
* |sink|,
10801082
* `'script'` as |sinkGroup|.
10811083

10821084
If the algorithm threw an error, rethrow the error.
@@ -1171,9 +1173,9 @@ partial interface HTMLScriptElement {
11711173

11721174
#### Slots with trusted values #### {#slots-with-trusted-values}
11731175

1174-
This document modifies {{HTMLScriptElement}}s. Each script has:
1176+
An {{HTMLScriptElement}} and {{SVGScriptElement}} have:
11751177

1176-
: an associated string <dfn export for="HTMLScriptElement">script text</dfn>.
1178+
: an associated string <dfn export for="HTMLScriptElement,SVGScriptElement">script text</dfn>.
11771179
:: A string, containing the body of the script to execute that was set
11781180
through a compliant sink. Equivalent to script's
11791181
[=child text content=]. Initially an empty string.
@@ -1207,6 +1209,8 @@ The {{HTMLScriptElement/textContent}} getter steps are:
12071209

12081210
1. Return the result of running [=get text content=] with [=this=].
12091211

1212+
Note: Currently we don't add an equivalent to {{SVGScriptElement}}. See [https://github.com/w3c/trusted-types/issues/512](https://github.com/w3c/trusted-types/issues/512).
1213+
12101214
#### The {{HTMLScriptElement/text}} IDL attribute #### {#the-text-idl-attribute}
12111215

12121216
Update the {{HTMLScriptElement/text}} setter steps algorithm as follows.
@@ -1249,7 +1253,9 @@ Modify the [=The text insertion mode=] algorithm as follows:
12491253
</dd>
12501254
</dl>
12511255

1252-
Issue: The above algorithm doesn't account for the case when the script element's content is changed mid-parse. Implementors should ensure they protect against this case. See [https://github.com/w3c/trusted-types/issues/507](https://github.com/w3c/trusted-types/issues/507).
1256+
Issue: The above algorithm doesn't account for the case when the script element's content is changed mid-parse. Implementors must ensure they protect against this case. See [https://github.com/w3c/trusted-types/issues/507](https://github.com/w3c/trusted-types/issues/507).
1257+
1258+
Issue: There's no proper definition for the processing of SVG script elements. However, implementations must apply a similar change to the processing of {{SVGScriptElement}}s.
12531259

12541260
#### Slot value verification #### {#slot-value-verification}
12551261

@@ -1275,6 +1281,8 @@ The first few steps of the [=prepare the script element=] algorithm are modified
12751281
<li>...
12761282
</ol>
12771283

1284+
Issue: There's no proper definition for the processing of SVG script elements. However, implementations must apply a similar change to the processing of {{SVGScriptElement}}s.
1285+
12781286
## Integration with DOM ## {#integration-with-dom}
12791287

12801288
Note: See [https://github.com/whatwg/dom/pull/1268](https://github.com/whatwg/dom/pull/1268) which upstreams this integration.

0 commit comments

Comments
 (0)