Skip to content

Commit

Permalink
Use event handler content attribute concept
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Apr 17, 2024
1 parent a4d005e commit 123ce3a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,6 @@ Its value is initially « ».
</table>
1. Return |expectedType|.

Note: Step 3 is a special case for <a href=https://html.spec.whatwg.org/#event-handler-name>event handler names</a>, as they always start with "on".

<div class="example" id="get-property-type-example">
<xmp highlight="js">
trustedTypes.getPropertyType('div', 'innerHTML'); // "TrustedHTML"
Expand All @@ -701,7 +699,6 @@ Its value is initially « ».

1. Set |localName| to |tagName| in [=ASCII lowercase=].
1. Set |attribute| to |attribute| in [=ASCII lowercase=].
1. If |attribute| starts with "on", then return {{TrustedScript}}.
1. If |elementNs| is an empty string, set |elementNs| to [=HTML namespace=].
1. If |attrNs| is an empty string, set |attrNs| to null.
1. Let |interface| be the [=element interface=] for |localName| and |elementNs|.
Expand All @@ -713,8 +710,6 @@ Its value is initially « ».
1. If |attributeData| is not null, then set |expectedType| to the value of the third member of |attributeData|.
1. Return |expectedType|.

Note: Step 3 is a special case for <a href=https://html.spec.whatwg.org/#event-handler-name>event handler names</a>, as they always start with "on".

<div class="example" id="get-attribute-type-example">
<xmp highlight="js">
trustedTypes.getAttributeType('script', 'src'); // "TrustedScriptURL"
Expand Down Expand Up @@ -1110,6 +1105,8 @@ To <dfn abstract-op export>get Trusted Types-compliant attribute value</dfn> on
To <dfn abstract-op>Get Trusted Type data for attribute</dfn> given |element|, |attribute|, |attributeNs|, perform the following steps:

1. Let |data| be null.
1. If |attributeNs| is null, and |attribute| is the name of an [=event handler content attribute=], then:
1. Return ({{Element}}, null, {{TrustedScript}}, "Element " + |attribute|).
1. Find the row in the following table, where |element| is in the first column, |attributeNs| is in the second column,
and |attribute| is in the third column.
If a matching row is found, set |data| to that row.
Expand All @@ -1127,8 +1124,6 @@ To <dfn abstract-op>Get Trusted Type data for attribute</dfn> given |element|, |

1. Return |data|.

Issue: This algorithm should account for event handler attributes. See https://github.com/w3c/trusted-types/issues/474

# Integrations # {#integrations}

<pre class="idl">
Expand Down

0 comments on commit 123ce3a

Please sign in to comment.