Bug Tracker

Modify

Ticket #8098 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Enhancement: Some `globalEval` optimizations

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

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

comment:1 Changed 3 years ago by rwaldron

  • Owner set to mathias
  • Status changed from new to assigned

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 3 years ago by jitter

  • Priority changed from undecided to low
  • Component changed from unfiled to core
  • Milestone changed from 1.next to 1.5.1

comment:3 Changed 3 years ago by Mathias Bynens

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

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

Changeset: 462bb1f66abf239492ee33c60feee3402fe64f77

comment:4 Changed 3 years ago by jitter

  • Version changed from git to 1.5

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.