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

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

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
  1. $
  2. .fadeIn([duration])
  3. .fadeOut([duration])
  4. .attr(attributeName,value)
  5. .append(content)
  6. .each(function(index,Element))
  7. .css(propertyName,value)
  8. .hover(handlerIn(eventObject),handlerOut(eventObject))
  9. .stop([clearQueue],[jumpToEnd])
  10. .parent()
  11. .eq(index)

JavaScript

  1. setInterval(expression,timeout)
  2. clearInterval(timeoutId)
  3. setTimeout(expression,timeout)
  4. 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!














    • Topic Participants

    • admin