Question

I've recently started upgrading jQuery for a clients website and come across some legacy code using deprecated jQuery. Consider:

jQuery(setClass).css((jQuery.browser.msie && jQuery.browser.version < 7 ? '' : 'min-') + 'height', maxHeight + 'px');

I'd like to achieve the same thing using a modern alternative rather than spoofing my jQuery by re-enabling .browser.

Any suggestions?

No correct solution

OTHER TIPS

Conditional comments with multiple stylesheets would likely be a better way of handling this, however, I would suggest removing the need to handle this by dropping support for IE6. And while you're at it, drop IE7.

Both IE6 and IE7 have dropped to a point where it generally isn't worth supporting them anymore. If a particular system only runs properly on IE7, IE8+ can still support said systems using compatibility mode.

If dropping support and/or conditional comments aren't applicable, another option would be to include the jQuery Migrate plugin which re-introduces .browser.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top