Bug Tracker

Modify

Ticket #12333 (closed bug: fixed)

Opened 20 months ago

Last modified 20 months ago

$.browser.webkit (undefined) -> $.browser.chrome

Reported by: Ult Combo Owned by: dmethvin
Priority: blocker Milestone: 1.8.1
Component: support Version: 1.8.0
Keywords: Cc:
Blocking: Blocked by:

Description

$.browser.webkit returns undefined when using Windows' Google Chrome 22 Dev - 23 Canary in jQuery 1.8.0, but returns true when using jQuery 1.7.2.

I noticed that version 1.8.0 introduced $.browser.chrome (which seemingly replaces the $.browser.webkit for Chrome browsers), but there's no documentation $.browser.chrome in the  jQuery.browser page.

Test cases:

 Chrome, jQuery 1.8.0 - $.browser.chrome = true; $.browser.webkit = undefined

 Chrome, jQuery 1.7.2 - $.browser.chrome = undefined; $.browser.webkit = true

Proposed patch: set the $.browser.webkit flag to true in jQuery 1.8 for back-compat, add documentation about $.browser.chrome.

Change History

comment:1 Changed 20 months ago by dmethvin

  • Owner set to dmethvin
  • Priority changed from undecided to blocker
  • Status changed from new to assigned
  • Component changed from unfiled to support
  • Milestone changed from None to 1.8.1

Agreed. Let's fix this and then never touch $.browser again.

comment:2 follow-up: ↓ 5 Changed 20 months ago by b.n.williams@…

According to the jquery blog post at  http://blog.jquery.com/2012/06/22/jquery-1-8-beta-1-see-whats-coming-and-going/ $.browser is going to be dropped completely. They mentioned they'll be making plugins for deprecated features such as this, but looks like it won't be released until 1.9. So I put together a plugin for now, and added support for fixing this bug (that i also ran into)

 https://github.com/scien/jquery.browser

comment:3 Changed 20 months ago by Dave Methvin

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

Fix #12333. Chrome needs $.browser.webkit too.

Changeset: 465959e75c08f7f1961071832a8c27a205bf05d0

comment:4 Changed 20 months ago by Ult Combo

Thanks for the fix, and also thanks b.n.williams for the plugin, in case the worst happens in the future. I know $.browser is already deprecated, but there are some browser peculiarities which can't be solved by simple feature detection.

Seeing as $.browser doesn't do much more than sniffing the userAgent string with some regexes and it doesn't have any external jQuery method dependency, it should still work fine in any future jQuery version without maintenance.

I hope the deprecated methods would be supplied in a CDN copy of jQuery as well, to have it already cached in the browser without generating more HTTP requests as a plugin/extension would. It's possible to remove the Deprecated methods from a custom jQuery build using the grunt command line, it shouldn't be hard to have a core build and a core+deprecated build now and in future. Anyway, even if the deprecated methods are supplied in a different JS file from a CDN, I'll be fine with that.

comment:5 in reply to: ↑ 2 Changed 20 months ago by scott.gonzalez

Replying to b.n.williams@…:

According to the jquery blog post at  http://blog.jquery.com/2012/06/22/jquery-1-8-beta-1-see-whats-coming-and-going/ $.browser is going to be dropped completely. They mentioned they'll be making plugins for deprecated features such as this, but looks like it won't be released until 1.9. So I put together a plugin for now, and added support for fixing this bug (that i also ran into)

 https://github.com/scien/jquery.browser

There's an official back-compat plugin:  https://github.com/jquery/jquery-browser

We should probably just get fixes into there instead of having the community creating their own. Otherwise, we might as well abandon the official one.

comment:6 Changed 20 months ago by dmethvin

The 1.9-compat plugin will have $.browser and include this fix, it just won't be around until 1.9 draws near.

The Google and Microsoft CDNs make their own decisions about what files to host, there is also cdnjs.com for some common and popular third-party plugins. But if you need a dozen plugins for a page you're almost always better off combining and compressing them into a single file and hosting it locally rather than including a dozen individual files from a CDN.

comment:7 Changed 20 months ago by dmethvin

#12390 is a duplicate of this ticket.

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.