CARVIEW |
Select Language
HTTP/2 200
date: Mon, 06 Oct 2025 05:36:40 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/jquery/jquery.git
etag: W/"9c77851c058f3ec8fc161af576557716"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=yH93Rhr1moCke%2BqPZMtFUTZrMA7BX%2FIuX%2B4o7njIntJdee09Q3y7Ib7cQ7BkmrG13iUlIBnxtb%2BEdqF2V0k6LXEK77eWx%2FsSG%2F056ApqoxzZDomXUT0Rp6YkiOdmoHifWQDlTTIQcCEga6FTJYzIejzFsfyQ8u29aorMeheDTMKsvzrrJAjLRfzIsthk1fJTUyS6FcQCLeoNx7Mj8fNhSEcEZNraos0t8ka8N6fu4ZpLyeA%2BgWpSiUy9vTsJAe77pe%2FQWegYtRiXlI%2FZZKJx6g%3D%3D--n9m1QxJSeLVSRUTq--pwIix0fUllwO8Jggsjml0w%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1645701278.1759728999; Path=/; Domain=github.com; Expires=Tue, 06 Oct 2026 05:36:39 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 06 Oct 2026 05:36:39 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: E4D6:303F0D:143B9E2:1B182FA:68E35567
Manipulation: Avoid concatenating strings in buildFragment · jquery/jquery@9c98e4e · GitHub
Copy file name to clipboardExpand all lines: src/manipulation/buildFragment.js
Copy file name to clipboardExpand all lines: src/manipulation/wrapMap.js
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Commit 9c98e4e
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>1 parent 7a6fae6 commit 9c98e4eCopy full SHA for 9c98e4e
File tree
Expand file treeCollapse file tree
3 files changed
+23
-13
lines changedFilter options
- src/manipulation
- test/unit
Expand file treeCollapse file tree
3 files changed
+23
-13
lines changedCollapse file: src/manipulation/buildFragment.js
src/manipulation/buildFragment.js
Copy file name to clipboardExpand all lines: src/manipulation/buildFragment.js+8-6Lines changed: 8 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
| 4 | + | |
4 | 5 |
| |
5 | 6 |
| |
6 | 7 |
| |
| |||
35 | 36 |
| |
36 | 37 |
| |
37 | 38 |
| |
38 |
| - | |
39 |
| - | |
| 39 | + | |
40 | 40 |
| |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 |
| - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
45 | 45 |
| |
46 | 46 |
| |
| 47 | + | |
| 48 | + | |
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
|
Collapse file: src/manipulation/wrapMap.js
src/manipulation/wrapMap.js
Copy file name to clipboardExpand all lines: src/manipulation/wrapMap.js+4-7Lines changed: 4 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
2 | 1 |
| |
3 | 2 |
| |
4 | 3 |
| |
5 | 4 |
| |
6 | 5 |
| |
7 | 6 |
| |
8 | 7 |
| |
9 |
| - | |
10 |
| - | |
11 |
| - | |
12 |
| - | |
13 |
| - | |
14 |
| - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
15 | 12 |
| |
16 | 13 |
| |
17 | 14 |
| |
|
Collapse file: test/unit/manipulation.js
+11Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2969 | 2969 |
| |
2970 | 2970 |
| |
2971 | 2971 |
| |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + |
You can’t perform that action at this time.
0 commit comments