Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Uncaught TypeError: Cannot read property 'msie' of undefined #272

Closed
brmo opened this issue Jan 16, 2013 · 14 comments
Closed

Uncaught TypeError: Cannot read property 'msie' of undefined #272

brmo opened this issue Jan 16, 2013 · 14 comments

Comments

@brmo
Copy link

brmo commented Jan 16, 2013

Jquery 1.9.0, Uniform 2.0

http://bugs.jquery.com/ticket/13214

@exside
Copy link

exside commented Jan 16, 2013

Sure... $.browser is finally removed in jQuery 1.9.0...so yes =), you'll get this error and yes, it should be corrected using $.support or something else, but there are a looot of scripts out there that still use $.browser (probably as long as f***ing IE is sticking around)...don't know if that was a good idea of the jQuery team. A solution to this (if you really need to use 1.9.0) is to use jQuery migrate which incorporates all the striped out stuff, can be found here:

https://github.com/jquery/jquery-migrate/#readme

In the case of uniform it could be quite difficult to solve this because it's really targeting misbehaving of old IE's 6 and 7, and I don't see anything from $.support to detect these problems, so one way to have compatibility with these browsers would be to have the HTML5 Boilerplate html or body tag conditionals that add classes, so that stuff could be done by something like

if ( $('.ie6').length ) {
// do some stuff for ie6
}

but that would require the devs that want to support these browsers to have these classes in place somewhere (what they probably do anyway if they know what they do =D)

@fidian
Copy link
Collaborator

fidian commented Jan 16, 2013

Looks like I need to get some sort of browser detection put into Uniform. For not I suggest using the migrate stuff above. I'll look into what it takes to do proper feature detection to detect IE. Basically, we're just looking for older IEs that don't support styling select lists properly and some versions of IE that don't do click events correctly.

@iamwavecut
Copy link

Official jQuery API recommends using $.feature detector which built in in jQuery instead of $.browser.
http://api.jquery.com/jQuery.browser/

@fidian
Copy link
Collaborator

fidian commented Jan 17, 2013

It's actually $.support, and according to its documentation, they can be changed or removed pretty quick. Instead of maybe relying on something that could be $.browser.msie or $.support.someFeatureIDoNotKnow or in the future rolling my own, I might just make a jQuery plugin that does browser detection by feature detection. Even more unappealing is this phrase from the documentation:

For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.

So, basically it's there but don't use it. Bummer.

@iMattPro
Copy link

@fidian

IE = /MSIE/i.test(navigator.userAgent);
IE6 = /MSIE 6/i.test(navigator.userAgent);
IE7 = /MSIE 7/i.test(navigator.userAgent);
IE8 = /MSIE 8/i.test(navigator.userAgent);

@fidian
Copy link
Collaborator

fidian commented Jan 21, 2013

I'm totally aware of that, but I also know that user agents can be changed and Opera frequently masquerades as IE by saying "MSIE 6". I do have a bunch of test results for feature detection on all sorts of browsers and I'll put some time into this problem tomorrow. However, I'd rather solve this for the Trident engine as opposed to just IE.

@codeablehq
Copy link

As a temporary solution, I just added Bowser as a dependency and fixed all the lines that depend on $.browser - it adds .5k which is neglectable if you can live with the extra dependency

@Mottie
Copy link

Mottie commented Jan 28, 2013

Here is a solution for detecting IE which can be used instead of $.browser.

@mimoo
Copy link

mimoo commented Feb 2, 2013

Using solution from here: #278 until you fix this. Nice plugin ;)

@fidian
Copy link
Collaborator

fidian commented Feb 5, 2013

Thanks for the tips and possible ways to work around this problem. I didn't know that so many people used Uniform.

Over the last couple weeks, I've done some work on the develop branch to detect the browser rendering engine through feature detection. I've also ran this code through over 150 different browser/os combinations so I feel pretty comfortable with the changes. The develop branch currently has these changes in it and I hope to pump out version 2.1.0 soon (today?) with this and better support for multiple themes on a single page.

@fidian
Copy link
Collaborator

fidian commented Feb 12, 2013

Issue #291 posed arguments against needing any browser detection at all for two instances and suggested $.support. I already implemented one change in the develop branch, argued against taking out the other browser detection and argued against using $.support since jQuery says to not use it.

I also found that IE10 drops support for conditional comments. :-) On the brighter side, I think I've got a good combination that I'll be committing today after I test it more on some computers I have available.

@fidian
Copy link
Collaborator

fidian commented Feb 12, 2013

It's in the develop branch.

@darshanags
Copy link

With reference to issue #291:

Point 1 - thanks!
Point 2 - I didn't have time to check this particular test case and that where my question originated from.
Point 3 - You are correct, jQuery advices us not to depend on $.support for good reasons (instead they recommend using modernizr). Feature detection is and always will be subject to change in future browser implementations. The jQuery documentation for $.support itself is out of date as of today. Hence my suggestion about using $.support.shrinkWrapBlocks to target IE6, which I believe is future proof and from my testing, return true only in IE6.

@fidian
Copy link
Collaborator

fidian commented Feb 19, 2013

Closing. If this doesn't work for anyone, please provide lots of useful information in either this issue or open a new one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants