On Jan 26, 1:02 pm, Kevin Dalman <[email protected]> wrote: > @Matt: This may be functional... > useIframe:/*...@cc_on @*//*...@if (@_win32) true, @else @*/false,/*...@end @*/ > But using a conditional comment 'hack' is just browser/platform > sniffing by another name.
It's a different, more reliable method. > You could have written: > var isWin32 = false; > /*...@cc_on isWin32=true; @*/ > var useIframe = isWin32; > So how is this 'better' than: > var useIframe = $.browser.msie && $.browser.version < 7; Browser "sniffing" relies on the user-agent header of the browser. This has been shown to be unreliable. Any browser can insert any string it wishes. Browsers are known to fake this to appear as IE, for example. Just because a browser says it is IE doesn't mean that it has the IE functionality that you may be expecting. This is why the concept of feature detection is vital. Conditional comments will be ignored by any browser except IE. If another browser is pretending to be IE, it would fool your test, but not the cc version. It is a more robust (although still imperfect) test. > Even the skilled developers in this forum cannot agreement how best to > 'replace' $.browser functionality. It would be great to address each concern as they come in. Nearly every issue can be addressed using proper feature detection strategies rather than browser sniffing. And once this is done, jQuery and plugins may begin working properly in browsers that technically aren't in the supported list. This would be a great step forward. > FYI, here is just one example of where I use 'browser detection' to > optimize functionality... > // IE CAN read dims of 'hidden' elements - FF CANNOT > As with bgIframe, there is no 'feature' to check, so $.support is > useless. Why not just check the value, and if it is 0 or undefined/null, apply the "visibility" fix? Then you are completely browser-agnostic. Matt Kruse --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
