Skip to main content

Bug Tracker

Side navigation

#13291 closed feature (notabug)

Opened January 21, 2013 09:44PM UTC

Closed January 29, 2013 07:45PM UTC

Optimize jQuery.type() for 2.0

Reported by: jdalton Owned by:
Priority: low Milestone: None
Component: core Version: git
Keywords: Cc:
Blocked by: Blocking:
Description

I noticed in jQuery 2.0 jQuery.type has:

```

return typeof obj === "object" || typeof obj === "function" ?

class2type[ core_toString.call(obj) ] ....

```

Modern browsers no longer have the old browser issue of reporting regexes as typeof function, sothe `typeof obj === "function" guard can be removed.

Attachments (0)
Change History (7)

Changed January 21, 2013 10:03PM UTC by dmethvin comment:1

component: unfiledcore
milestone: None2.0
priority: undecidedlow
status: newopen

Might be worth going through to see where we could use typeof directly now.

Changed January 22, 2013 12:52AM UTC by rwaldron comment:2

We have a pull request for this...

Changed January 27, 2013 02:14AM UTC by dmethvin comment:3

Changed January 29, 2013 07:41PM UTC by dmethvin comment:4

resolution: fixed
status: closedreopened

Changed January 29, 2013 07:42PM UTC by Dave Methvin comment:5

resolution: → fixed
status: reopenedclosed

Revert "Fix #13291, no longer need the functionish-regex guard."

Turns out this is still needed by Safari 5.1, which we're still supporting.

This reverts commit c4b1da40075532e4f14821b1519ae0ef6665bf1e.

Changeset: aa3c92979a723cd972bf37c766c3b4a63cc23fdb

Changed January 29, 2013 07:44PM UTC by dmethvin comment:6

resolution: fixed
status: closedreopened

Changed January 29, 2013 07:45PM UTC by dmethvin comment:7

milestone: 2.0None
resolution: → notabug
status: reopenedclosed