Skip to main content

Bug Tracker

Side navigation

#8098 closed enhancement (fixed)

Opened January 31, 2011 04:23PM UTC

Closed February 02, 2011 12:02AM UTC

Last modified March 19, 2012 09:24PM UTC

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).
Attachments (0)
Change History (4)

Changed January 31, 2011 04:33PM UTC by rwaldron comment:1

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

Changed January 31, 2011 06:47PM UTC by jitter comment:2

component: unfiledcore
milestone: 1.next1.5.1
priority: undecidedlow

Changed February 02, 2011 12:02AM UTC by Mathias Bynens comment:3

resolution: → fixed
status: assignedclosed

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

Changeset: 462bb1f66abf239492ee33c60feee3402fe64f77

Changed February 02, 2011 12:03AM UTC by jitter comment:4

version: git1.5