Attributes: Don't stringify attributes in the setter
commit4250b628783d7bfa92ec6c5550c6e4b22fab6034
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 1 Nov 2021 17:10:23 +0000 (1 18:10 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Nov 2021 17:10:23 +0000 (1 18:10 +0100)
tree10fbd9709b4cc929b92e3f394332667846aed330
parent4fd6912bfd8fffbfabc98a9b0789d28f10af0914
Attributes: Don't stringify attributes in the setter

Stringifying attributes in the setter was needed for IE <=9 but it breaks
trusted types enforcement when setting a script `src` attribute.

Note that this doesn't mean script execution works. Since jQuery disables all
scripts by changing their type and then executes them by creating fresh script
tags with proper `src` & possibly other attributes, this unwraps any trusted
`src` wrappers, making the script not execute under strict CSP settings.
We might try to fix it in the future in a separate change.

Fixes gh-4948
Closes gh-4949
src/attributes/attr.js
test/data/mock.php
test/data/trusted-types-attributes.html [new file with mode: 0644]
test/data/trusted-types-attributes.js [new file with mode: 0644]
test/middleware-mockserver.js
test/unit/attributes.js