Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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 Rick Waldron

That's so annoying.

comment:2 Changed 11 years ago by 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?

comment:3 in reply to:  2 Changed 11 years ago by gibson042

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 gibson042

Component: unfiledmanipulation
Status: newopen

comment:5 Changed 11 years ago by gibson042

Owner: set to gibson042
Status: openassigned

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 Richard Gibson

Resolution: fixed
Status: assignedclosed

Fix #13315: compare typeof node.method to var instead of literal "undefined" for safer uglification

Changeset: ec9b38a34fb9bd81d1903cf12b69466f699abca5

comment:7 Changed 11 years ago by gibson042

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:8 Changed 11 years ago by dmethvin

#13328 is a duplicate of this ticket.

comment:9 Changed 11 years ago by dmethvin

#13320 is a duplicate of this ticket.

comment:10 Changed 11 years ago by Richard Gibson

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 dmethvin

Milestone: None1.9.1
Priority: undecidedblocker
Note: See TracTickets for help on using tickets.