Skip to main content

Bug Tracker

Side navigation

#13315 closed bug (fixed)

Opened January 24, 2013 02:09AM UTC

Closed January 24, 2013 05:14AM UTC

Last modified January 27, 2013 07:12PM UTC

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. :)

Attachments (0)
Change History (11)

Changed January 24, 2013 02:13AM UTC by rwaldron comment:1

That's so annoying.

Changed January 24, 2013 02:30AM UTC by jaubourg comment:2

+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?

Changed January 24, 2013 02:33AM UTC by gibson042 comment:3

Replying to [comment:2 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.

Changed January 24, 2013 03:41AM UTC by gibson042 comment:4

component: unfiledmanipulation
status: newopen

Changed January 24, 2013 04:14AM UTC by gibson042 comment:5

owner: → 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.

Changed January 24, 2013 05:14AM UTC by Richard Gibson comment:6

resolution: → fixed
status: assignedclosed

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

Changeset: ec9b38a34fb9bd81d1903cf12b69466f699abca5

Changed January 24, 2013 04:49PM UTC by gibson042 comment:7

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.

Changed January 25, 2013 06:43PM UTC by dmethvin comment:8

#13328 is a duplicate of this ticket.

Changed January 26, 2013 02:49PM UTC by dmethvin comment:9

#13320 is a duplicate of this ticket.

Changed January 27, 2013 03:31PM UTC by Richard Gibson comment:10

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

(cherry picked from commit ec9b38a34fb9bd81d1903cf12b69466f699abca5)

Changeset: 64b55f0b7912d96c3bdae8c771b4da99c96954fd

Changed January 27, 2013 07:12PM UTC by dmethvin comment:11

milestone: None1.9.1
priority: undecidedblocker