Bug Tracker

Ticket #13315 (closed bug: fixed)

Opened 22 months ago

Last modified 22 months ago

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:
Blocking: Blocked by:

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

comment:1 Changed 22 months ago by rwaldron

That's so annoying.

comment:2 follow-up: ↓ 3 Changed 22 months 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 22 months 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 22 months ago by gibson042

  • Status changed from new to open
  • Component changed from unfiled to manipulation

comment:5 Changed 22 months ago by gibson042

  • Owner set to gibson042
  • Status changed from open to 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 22 months ago by Richard Gibson

  • Status changed from assigned to closed
  • Resolution set to fixed

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

Changeset: ec9b38a34fb9bd81d1903cf12b69466f699abca5

comment:7 Changed 22 months 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 22 months ago by dmethvin

#13328 is a duplicate of this ticket.

comment:9 Changed 22 months ago by dmethvin

#13320 is a duplicate of this ticket.

comment:10 Changed 22 months 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 22 months ago by dmethvin

  • Priority changed from undecided to blocker
  • Milestone changed from None to 1.9.1
Note: See TracTickets for help on using tickets.