Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,14 +1069,16 @@ Given a {{TrustedType}} type (|expectedType|), a [=realm/global object=] (|globa

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

Given an {{HTMLScriptElement}} (|script|), this algorithm performs the following steps:
Given an {{HTMLScriptElement}} or {{SVGScriptElement}} (|script|), this algorithm performs the following steps:

1. Let |sink| be "`HTMLScriptElement text`" if |script| is an {{HTMLScriptElement}}; otherwise "`SVGScriptElement text`".

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

If the algorithm threw an error, rethrow the error.
Expand Down Expand Up @@ -1171,9 +1173,9 @@ partial interface HTMLScriptElement {

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

This document modifies {{HTMLScriptElement}}s. Each script has:
An {{HTMLScriptElement}} and {{SVGScriptElement}} have:

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

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

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).

#### The {{HTMLScriptElement/text}} IDL attribute #### {#the-text-idl-attribute}

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

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).
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).

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.

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

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

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.

## Integration with DOM ## {#integration-with-dom}

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