jquery/test
Michał Gołębiowski-Owczarek de5398a6ad
Core:Manipulation: Add basic TrustedHTML support
This ensures HTML wrapped in TrustedHTML can be used as an input to jQuery
manipulation methods in a way that doesn't violate the
`require-trusted-types-for` Content Security Policy directive.
This commit builds on previous work needed for trusted types support, including
gh-4642 and gh-4724.

One restriction is that while any TrustedHTML wrapper should work as input
for jQuery methods like `.html()` or `.append()`, for passing directly to the
`jQuery` factory the string must start with `<` and end with `>`; no trailing
or leading whitespaces are allowed. This is necessary as we cannot parse out
a part of the input for further construction; that would violate the CSP rule -
and that's what's done to HTML input not matching these constraints.

No trusted types API is used explicitly in source; the majority of the work is
ensuring we don't pass the input converted to string to APIs that would
eventually assign it to `innerHTML`. This extra cautiousness is caused by the
API being Blink-only, at least for now.

The ban on passing strings to `innerHTML` means support tests relying on such
assignments are impossible. We don't currently have such tests on the `main`
branch but we used to have many of them in the 3.x & older lines. If there's
a need to re-add such a test, we'll need an escape hatch to skip them for apps
needing CSP-enforced TrustedHTML.

See https://web.dev/trusted-types/ for more information about TrustedHTML.

Fixes gh-4409
Closes gh-4927
Ref gh-4642
Ref gh-4724
2021-09-30 16:00:24 +02:00
..
data Core:Manipulation: Add basic TrustedHTML support 2021-09-30 16:00:24 +02:00
integration Event: Fix delegated radio events when arrow keys are used 2015-10-18 13:06:37 -04:00
node_smoke_tests Build: Update jsdom; migrate a test with Symbol polyfill to an iframe test 2019-03-04 18:30:51 +01:00
promises_aplus_adapters Build: Update jsdom; migrate a test with Symbol polyfill to an iframe test 2019-03-04 18:30:51 +01:00
unit Core:Manipulation: Add basic TrustedHTML support 2021-09-30 16:00:24 +02:00
.eslintrc.json Core:Manipulation: Add basic TrustedHTML support 2021-09-30 16:00:24 +02:00
delegatetest.html Tests: Change quotes according to style guidelines 2015-10-18 13:17:23 -04:00
hovertest.html Ref #13316: Sync all documents on full vs. minified source. Close gh-1147. 2013-02-07 15:16:28 -05:00
index.html Build: Restore the external directory 2021-03-24 23:36:25 +01:00
jquery.js Core: Drop support for Edge Legacy (i.e. non-Chromium Microsoft Edge) 2020-09-22 17:49:28 +02:00
karma.context.html Build: Use the US spelling of "favor" 2020-07-22 16:12:54 +02:00
karma.debug.html Build: Restore the external directory 2021-03-24 23:36:25 +01:00
localfile.html Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
middleware-mockserver.js Core:Manipulation: Add basic TrustedHTML support 2021-09-30 16:00:24 +02:00
networkerror.html Docs: Updated links to https where they are supported. 2016-01-13 13:26:10 -05:00
xhtml.php Added a way to run the test suite as an XHTML page. 2009-01-19 18:14:51 +00:00