#13315 closed bug (fixed)
minified manipulation methods fail on oldIE with XML
Reported by: | gibson042 | Owned by: | gibson042 |
---|---|---|---|
Priority: | blocker | Milestone: | 1.9.1 |
Component: | manipulation | Version: | git |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
A handful of our methods (among them the manipulation-module internal getAll
) employ a clever typeof node.<DOM method> !== "undefined"
hack because oldIE sometimes tries to evaluate the methods (and fails for insufficient arguments) if we test them directly.
Unfortunately, UglifyJS undoes all our efforts and turns the pattern into n.<DOM method>!==<undefined>
. Core module test "jQuery(selector, xml).text(str) - Loaded via XML document" fails on oldIE when run against minified source for precisely this reason.
Secondarily, we should check jquery.min.js with TestSwarm. :)
Change History (11)
comment:1 Changed 11 years ago by
comment:2 follow-up: 3 Changed 11 years ago by
+1 on testing the minified build on TestSwarm. Has the uglify team been notified of this? Would it be possible to get an option to opt out of this optimization?
comment:3 Changed 11 years ago by
Replying to jaubourg:
+1 on testing the minified build on TestSwarm. Has the uglify team been notified of this? Would it be possible to get an option to opt out of this optimization?
I'm checking/posting now.
comment:4 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Status: | new → open |
Reported at https://github.com/mishoo/UglifyJS2/issues/105
comment:5 Changed 11 years ago by
Owner: | set to gibson042 |
---|---|
Status: | open → assigned |
For the record, safer auto-compressed output will add about 69 bytes after gzip. We can save more than half of that (+26) by comparing against a global variable instead of literal "undefined"
, and we can do it without waiting on dependency upgrades. Expect something along those lines later this week.
comment:6 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #13315: compare typeof node.method to var instead of literal "undefined" for safer uglification
Changeset: ec9b38a34fb9bd81d1903cf12b69466f699abca5
comment:7 Changed 11 years ago by
As an interesting side note, minification also undoes some of our performance micro-optimizations, replacing undefined
/true
/false
respectively with void 0
/!0
/!1
and making typeof comparisons loose (e.g., "string"==typeof v
instead of "string"===typeof v
).
I haven't checked on the latter size optimization, but the former is configurable and saves something like 40 bytes after gzip.
Also interesting, but probably not actionable, is that minification maps our internal variable jQuery
to a two-character identifier. Swapping it with a one-character identifier would save another 40 bytes gzipped.
comment:10 Changed 11 years ago by
Fix #13315 for IE9: compare typeof xmlNode.method to var instead of literal "undefined" for safer uglification (cherry picked from commit ec9b38a34fb9bd81d1903cf12b69466f699abca5)
Changeset: 64b55f0b7912d96c3bdae8c771b4da99c96954fd
comment:11 Changed 11 years ago by
Milestone: | None → 1.9.1 |
---|---|
Priority: | undecided → blocker |
That's so annoying.