- Notifications
You must be signed in to change notification settings - Fork20.6k
Commit924b515
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 still need to strip CDATA sections for backwards compatibility. Thisshouldn't be needed as in XML documents they're already not visible wheninspecting element contents and in HTML documents they have no meaning butwe're preserving that logic for backwards compatibility. This will be removedcompletely in 4.0.Fixesgh-4904Closesgh-4905Refgh-49061 parentf12cac6 commit924b515
2 files changed
+20
-2
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
| 43 | + | |
| 44 | + | |
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
| |||
195 | 196 |
| |
196 | 197 |
| |
197 | 198 |
| |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
198 | 205 |
| |
199 | 206 |
| |
200 | 207 |
| |
|
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2268 | 2268 |
| |
2269 | 2269 |
| |
2270 | 2270 |
| |
2271 |
| - | |
| 2271 | + | |
2272 | 2272 |
| |
2273 | 2273 |
| |
2274 | 2274 |
| |
| |||
2293 | 2293 |
| |
2294 | 2294 |
| |
2295 | 2295 |
| |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
2296 | 2307 |
| |
2297 | 2308 |
| |
2298 | 2309 |
| |
|
0 commit comments
Comments
(0)