I think it’s best to have a conditional comment block that targets IE7 and above (as you have in your example). Chris Wilson has said that the next version of IE will operate the same as IE7 unless the developer opts in to the improved rendering engine.
I’m not sure about your isSaf function, it’s not reliable to use object detection for these because none of the objects you’re testing say “this is safari”, you’re relying on Safari being the only browser which supports them, which may not be the case in the future. If you’re going to have browser detections, use something completely browser specific like the user agent string, or browser specific objects like window.opera.
Having said that, window.opera may not be safe to use, look what happened with window.navigator.
Also, browser detection shouldn’t be computed every time, just set it as a variable, or have the function overwrite itself.
I think it’s best to have a conditional comment block that targets IE7 and above (as you have in your example). Chris Wilson has said that the next version of IE will operate the same as IE7 unless the developer opts in to the improved rendering engine.
I’m not sure about your isSaf function, it’s not reliable to use object detection for these because none of the objects you’re testing say “this is safari”, you’re relying on Safari being the only browser which supports them, which may not be the case in the future. If you’re going to have browser detections, use something completely browser specific like the user agent string, or browser specific objects like window.opera.
Having said that, window.opera may not be safe to use, look what happened with window.navigator.
Also, browser detection shouldn’t be computed every time, just set it as a variable, or have the function overwrite itself.