Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#8098 closed enhancement (fixed)

Enhancement: Some `globalEval` optimizations

Reported by: mathias Owned by: mathias
Priority: low Milestone: 1.5.1
Component: core Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description

Apparently pull requests do not suffice and enhancement requests need their own bug ticket, so here goes.

I’ve made this pull request on GitHub: https://github.com/jquery/jquery/pull/205

The changes I made are some minor optimizations to globalEval, namely:

  • Use the speedy `document.head` when it’s available in globalEval.
  • Don’t set script.type = text/javascript as it’s not needed — all browsers default to text/javascript if the type attribute is omitted (and it’s valid HTML too).

Change History (4)

comment:1 Changed 13 years ago by Rick Waldron

Owner: set to mathias
Status: newassigned

Bullet 1 is a no-brainer, but I'd like to see a document.head || document.getElementsByTagName( "head" )[ 0 ] || document.documentElement reference cached, because this is used elsewhere as well.

I definitely agree with bullet 2, without question. As far as I'm concerned setting the type is a waste of characters.

comment:2 Changed 13 years ago by jitter

Component: unfiledcore
Milestone: 1.next1.5.1
Priority: undecidedlow

comment:3 Changed 13 years ago by Mathias Bynens

Resolution: fixed
Status: assignedclosed

Fixes #8098. Use the fast document.head when available. Don't set unneeded "script.type = text/javascript".

Changeset: 462bb1f66abf239492ee33c60feee3402fe64f77

comment:4 Changed 13 years ago by jitter

Version: git1.5
Note: See TracTickets for help on using tickets.