How to feature-detect/test for specific jQuery (and Javascript) methods/functions used

Posted by Zildjoms on Stack Overflow See other posts from Stack Overflow or by Zildjoms
Published on 2010-03-30T22:06:06Z Indexed on 2010/03/30 22:43 UTC
Read the original article Hit count: 356

Filed under:
|
|

good day everyone, hope yer all doin awesome

am very new to javascript and jquery, and i (think) i have come up with a simple fade-in/out implementation on a site am workin on (check out http://www.s5ent.com/expandjs.html - if you have the time to check it for inefficiency or what that'd be real sweet). i use the following functions/methods/collections and i would like to do a feature test before using them. uhm.. how? or is there a better way to go about this?

jQuery

$
.fadeIn([duration])
.fadeOut([duration])
.attr(attributeName,value)
.append(content)
.each(function(index,Element))
.css(propertyName,value)
.hover(handlerIn(eventObject),handlerOut(eventObject))
.stop([clearQueue],[jumpToEnd])
.parent()
.eq(index)

JavaScript

setInterval(expression,timeout)
clearInterval(timeoutId)
setTimeout(expression,timeout)
clearTimeout(timeoutId)

i tried looking into jquery.support for the jquery ones, but i find myself running into conceptual problems with it, i.e. for fadein/fadeout, i (think i) should test for $.support.opacity, but that would be false in ie whereas ie6+ could still fairly render the fades.

also am using jquery 1.2.6 coz that's enough for what i need. the support object is in 1.3. so i'm hoping to avoid dragging-in more unnecessary code if i can.

i also worked with browser sniffing, no matter how frowned-upon. but that's also a bigger problem for me because of non-standard ua strings and spoofing and everything else am not aware of.

so how do you guys think i should go about this? or should i even? is there a better way to go about making sure that i don't run code that'll eventually break the page? i've set it up to degrade into a css hover when javascript ain't there..

expertise needed. much appreciated, thanks guyz!

© Stack Overflow or respective owner

Related posts about feature

Related posts about test