jquery/test/unit
Michał Gołębiowski-Owczarek 9c98e4e86e
Manipulation: Avoid concatenating strings in buildFragment
Concatenating HTML strings in buildFragment is a possible security risk as it
creates an opportunity of escaping the concatenated wrapper. It also makes it
impossible to support secure HTML wrappers like
[trusted types](https://web.dev/trusted-types/). It's safer to create wrapper
elements using `document.createElement` & `appendChild`.

The previous way was needed in jQuery <4 because IE <10 doesn't accept table
parts set via `innerHTML`, even if the element which contents are set is
a proper table element, e.g.:
```js
tr.innerHTML = "<td></td>";
```
The whole structure needs to be passed in one HTML string. jQuery 4 drops
support for IE <11 so this is no longer an issue; in older version we'd have
to duplicate the code paths.

IE <10 needed to have `<option>` elements wrapped in
`<select multiple="multiple">` but we no longer need that on master which
makes the `document.createElement` way shorter as we don't have to call
`setAttribute`.

All these improvements, apart from making logic more secure, decrease the
gzipped size by 58 bytes.

Closes gh-4724
Ref gh-4409
Ref angular/angular.js#17028

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2020-06-10 16:13:22 +02:00
..
ajax.js Ajax: Overwrite s.contentType with content-type header value, if any 2020-04-06 21:15:55 +02:00
animation.js Build: Update Sinon from 2.3.7 to 7.3.1, other updates 2019-04-04 16:53:38 +02:00
attributes.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
basic.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
callbacks.js Build:Tests: Fix custom build tests, verify on Travis 2020-01-07 23:59:08 +01:00
core.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
css.js CSS: Include show, hide & toggle methods in the jQuery slim build 2020-05-05 14:16:41 +02:00
data.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
deferred.js Build:Tests: Fix custom build tests, verify on Travis 2020-01-07 23:59:08 +01:00
deprecated.js Deprecated: Remove jQuery.trim 2020-05-18 23:20:38 +02:00
dimensions.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
effects.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
event.js Tests: Use only one focusin/out handler per matching window & document 2020-04-27 21:37:06 +02:00
exports.js Build: Update test code for compatibility with QUnit 2.x (#4297) 2019-02-18 19:03:26 +01:00
manipulation.js Manipulation: Avoid concatenating strings in buildFragment 2020-06-10 16:13:22 +02:00
offset.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
queue.js Build:Tests: Fix custom build tests, verify on Travis 2020-01-07 23:59:08 +01:00
ready.js Tests: Pass a number of necessary done() calls to assert.async() 2020-03-02 22:15:06 +01:00
selector.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
serialize.js Build:Tests: Fix custom build tests, verify on Travis 2020-01-07 23:59:08 +01:00
support.js CSS: Workaround buggy getComputedStyle on table rows in IE/Edge 2019-10-14 18:41:35 +02:00
traversing.js Manipulation: Make jQuery.htmlPrefilter an identity function 2020-03-16 21:49:29 +01:00
tween.js Build: Update Sinon from 2.3.7 to 7.3.1, other updates 2019-04-04 16:53:38 +02:00
wrap.js Tests: Remove remaining obsolete jQuery.cache references 2020-05-18 18:43:01 +02:00