diff --git a/lib/mixins/template-stamp.js b/lib/mixins/template-stamp.js index ee4bc903c..4e4023c06 100644 --- a/lib/mixins/template-stamp.js +++ b/lib/mixins/template-stamp.js @@ -69,6 +69,52 @@ function fixPlaceholder(node) { } } +/** + * Copies an attribute from one element to another, converting the value to a + * `TrustedScript` if it is named like a Polymer template event listener. + * + * @param {!Element} dest The element to set the attribute on + * @param {!Element} src The element to read the attribute from + * @param {string} name The name of the attribute + */ +const copyAttributeWithTemplateEventPolicy = (() => { + /** + * This `TrustedTypePolicy` is used to work around a Chrome bug in the Trusted + * Types API where any attribute that starts with `on` may only be set to a + * `TrustedScript` value, even if that attribute would not cause an event + * listener to be created. (See https://crbug.com/993268 for details.) + * + * Polymer's template system allows `` and `` to be + * written using the `