- Notifications
You must be signed in to change notification settings - Fork20.6k
Commit2f8f39e
authored
Manipulation: Don't remove HTML comments from scripts
When evaluating scripts, jQuery strips out the possible wrapping HTML commentand a CDATA section. However, all supported browsers are already doing thatwhen loading JS via appending a script tag to the DOM which is how we've beendoing `jQuery.globalEval` since jQuery 3.0.0. jQuery logic was imperfect, e.g.it just stripped the `<!--` and `-->` markers, respectively at the beginning orthe end of the script contents. However, browsers are also stripping everythingfollowing those markers in the same line, treating them as single-line commentsdelimiters; this is now also mandated by ECMAScript 2015 in Annex B. Insteadof fixing the jQuery logic, just let the browser do its thing.We also used to strip CDATA sections. However, this shouldn't be needed as inXML documents they're already not visible when inspecting element contents andin HTML documents they have no meaning. We've preserved that behavior forbackwards compatibility in 3.x but we're removing it for 4.0.Fixesgh-4904Closesgh-49061 parent0f623fd commit2f8f39e
File tree
3 files changed
+22
-12
lines changed- src
- test
- data
- unit
3 files changed
+22
-12
lines changedLines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
29 |
| - | |
30 |
| - | |
| 28 | + | |
31 | 29 |
| |
32 | 30 |
| |
33 | 31 |
| |
| |||
161 | 159 |
| |
162 | 160 |
| |
163 | 161 |
| |
164 |
| - | |
| 162 | + | |
165 | 163 |
| |
166 | 164 |
| |
167 | 165 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
7 |
| - | |
| 7 | + | |
8 | 8 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
|
Lines changed: 18 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2233 | 2233 |
| |
2234 | 2234 |
| |
2235 | 2235 |
| |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
2236 | 2245 |
| |
2237 | 2246 |
| |
2238 |
| - | |
2239 |
| - | |
2240 |
| - | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
2241 | 2250 |
| |
2242 | 2251 |
| |
2243 | 2252 |
| |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
2244 | 2256 |
| |
2245 | 2257 |
| |
2246 |
| - | |
2247 |
| - | |
2248 |
| - | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
2249 | 2261 |
| |
2250 | 2262 |
| |
2251 | 2263 |
| |
|
0 commit comments
Comments
(0)