Skip to content

Commit

Permalink
Merge pull request #5701 from Polymer/trusted-types-reflected-boolean…
Browse files Browse the repository at this point in the history
…-properties

Adds Trusted Types support for reflected boolean properties.
  • Loading branch information
bicknellr authored Jun 2, 2022
2 parents 76e77b6 + d69041c commit c829815
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/mixins/properties-changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,13 @@ export const PropertiesChanged = dedupingMixin(
if (str === undefined) {
node.removeAttribute(attribute);
} else {
node.setAttribute(attribute, str);
node.setAttribute(
attribute,
// Closure's type for `setAttribute`'s second parameter incorrectly
// excludes `TrustedScript`.
(str === '' && window.trustedTypes) ?
/** @type {?} */ (window.trustedTypes.emptyScript) :
str);
}
}

Expand Down

0 comments on commit c829815

Please sign in to comment.