@@ -671,15 +671,29 @@ initially empty.
671671
672672 1. Set |localName| to |tagName| in [=ASCII lowercase=] .
673673 1. If |elementNs| is an empty string, set |elementNs| to [=HTML namespace=] .
674+ 1. If |property| starts with "on", then return {{TrustedScript}} .
674675 1. Let |interface| be the [=element interface=] for |localName| and |elementNs|.
675- 1. If |interface| has an IDL <a spec="webidl">attribute</a> member which identifier is |attribute|, and
676- {{StringContext}} IDL extended attribute appears on that attribute, return
677- stringified {{StringContext}} 's identifier and abort further steps.
678-
679- Note: This also takes into account all members of [=interface mixins=] that
680- |interface| [=includes=] .
681-
682- 1. Return null.
676+ 1. Let |expectedType| be null.
677+ 1. Find the row in the following table, where the first column is "*" or |interface|'s name, and |property| is in the second column.
678+ If a matching row is found, set |expectedType| to the value of the third column.
679+
680+ <table>
681+ <thead>
682+ <tr><th> Element<th> Property name<th> TrustedType
683+ <tbody>
684+ <tr><td> {{HTMLEmbedElement}} <td> "src"<td> {{TrustedScriptURL}}
685+ <tr><td> {{HTMLIFrameElement}} <td> "srcdoc"<td> {{TrustedHTML}}
686+ <tr><td> {{HTMLObjectElement}} <td> "codebase"<td> {{TrustedScriptURL}}
687+ <tr><td> {{HTMLObjectElement}} <td> "data"<td> {{TrustedScriptURL}}
688+ <tr><td> {{HTMLScriptElement}} <td> "innerText"<td> {{TrustedScript}}
689+ <tr><td> {{HTMLScriptElement}} <td> "src"<td> {{TrustedScriptURL}}
690+ <tr><td> {{HTMLScriptElement}} <td> "text"<td> {{TrustedScript}}
691+ <tr><td> {{HTMLScriptElement}} <td> "textContent"<td> {{TrustedScript}}
692+ <tr><td> "*"<td> "innerHTML"<td> {{TrustedHTML}}
693+ <tr><td> "*"<td> "outerHTML"<td> {{TrustedHTML}}
694+ </tbody>
695+ </table>
696+ 1. Return |expectedType|.
683697
684698 <div class="example" id="get-property-type-example">
685699 <xmp highlight="js">
@@ -698,15 +712,17 @@ initially empty.
698712
699713 1. Set |localName| to |tagName| in [=ASCII lowercase=] .
700714 1. Set |attribute| to |attribute| in [=ASCII lowercase=] .
715+ 1. If |attribute| starts with "on", then return {{TrustedScript}} .
701716 1. If |elementNs| is an empty string, set |elementNs| to [=HTML namespace=] .
702717 1. If |attrNs| is an empty string, set |attrNs| to null.
703718 1. Let |interface| be the [=element interface=] for |localName| and |elementNs|.
704- 1. If |interface| does not have an IDL <a spec="webidl">attribute</a> that [=reflects=] a content attribute with
705- |localName| local name and |attrNs| namespace,
706- return undefined and abort further steps. Otherwise, let |idlAttribute| be that IDL <a spec="webidl">attribute</a> .
707- 1. If {{StringContext}} IDL extended attribute appears on |idlAttribute|, return
708- stringified {{StringContext}} 's identifier and abort further steps.
709- 1. Return null.
719+ 1. Let |expectedType| be null.
720+ 1. Set |attributeData| to the result of [$Get Trusted Type data for attribute$] algorithm, with the following arguments:
721+ * |interface| as |element|
722+ * |attribute|
723+ * |attrNs|
724+ 1. If |attributeData| is not null, then set |expectedType| to the value of the third member of |attributeData|.
725+ 1. Return |expectedType|.
710726
711727 <div class="example" id="get-attribute-type-example">
712728 <xmp highlight="js">
@@ -1083,10 +1099,32 @@ Given an {{HTMLScriptElement}} (|script|), this algorithm performs the following
10831099## Get Trusted Types-compliant attribute value ## {#validate-attribute-mutation}
10841100To <dfn abstract-op export>get Trusted Types-compliant attribute value</dfn> on {{Attr}} |attribute| with {{Element}} |element| and {{TrustedType}} or a string |newValue|, perform the following steps:
10851101
1086- 1. Let |expectedType| be null.
1087- 1. Let |sink| be null.
1088- 1. Find the row in the following table, where |element| is in the first column, and |attribute|'s <a for="Attr">namespace</a> and <a for="Attr">local name</a> match the values in the second and third column, respectively.
1089- If a matching row is found, set |expectedType| and |sink| to the value of the fourth, and fifth column in that row, respectively.
1102+ 1. Set |attributeData| to the result of [$Get Trusted Type data for attribute$] algorithm, with the following arguments:
1103+ * |element|
1104+ * |attribute|'s <a for="Attr">local name</a> as |attribute|
1105+ * |attribute|'s <a for="Attr">namespace</a> as |attributeNs|
1106+ 1. If |attributeData| is null, then:
1107+ 1. If |newValue| is a string, return |newValue|.
1108+ 1. <a>Assert</a> : |newValue| is {{TrustedHTML}} or {{TrustedScript}} or {{TrustedScriptURL}} .
1109+ 1. Return |value|'s `[[Data]] ` internal slot value.
1110+ 1. Let |expectedType| be the value of the third member of |attributeData|.
1111+ 1. Let |sink| be the value of the fourth member of |attributeData|.
1112+ 1. Return the result of executing [$Get Trusted Type compliant string$] with the following arguments:
1113+ * |expectedType|
1114+ * |newValue| as |input|
1115+ * |element|'s <a>node document</a>' s <a>relevant global object</a> as |global|
1116+ * |sink|
1117+ * 'script' as |sinkGroup|
1118+
1119+ If the algorithm threw an error, rethrow the error.
1120+
1121+ ## Get Trusted Type data for attribute ## {#get-trusted-type-data-for-attribute}
1122+ To <dfn abstract-op>Get Trusted Type data for attribute</dfn> given |element|, |attribute|, |attributeNs|, perform the following steps:
1123+
1124+ 1. Let |data| be null.
1125+ 1. Find the row in the following table, where |element| is in the first column, |attributeNs| is in the second column,
1126+ and |attribute| is in the third column.
1127+ If a matching row is found, set |data| to that row.
10901128
10911129 <table>
10921130 <thead>
@@ -1102,18 +1140,7 @@ To <dfn abstract-op export>get Trusted Types-compliant attribute value</dfn> on
11021140 </tbody>
11031141 </table>
11041142
1105- 1. If |expectedType| is null, then:
1106- 1. If |newValue| is a string, return |newValue|.
1107- 1. <a>Assert</a> : |newValue| is {{TrustedHTML}} or {{TrustedScript}} or {{TrustedScriptURL}} .
1108- 1. Return |value|'s `[[Data]] ` internal slot value.
1109- 1. Return the result of executing [$Get Trusted Type compliant string$] with the following arguments:
1110- * |expectedType|
1111- * |newValue| as |input|
1112- * |element|'s <a>node document</a>' s <a>relevant global object</a> as |global|
1113- * |sink|
1114- * 'script' as |sinkGroup|
1115-
1116- If the algorithm threw an error, rethrow the error.
1143+ 1. Return |data|.
11171144
11181145# Integrations # {#integrations}
11191146
0 commit comments