All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.js.vendor.modernizr.src.testDOMProps.js Maven / Gradle / Ivy

The newest version!
define(['is', 'fnBind'], function(is, fnBind) {
  /**
   * testDOMProps is a generic DOM property test; if a browser supports
   *   a certain property, it won't return undefined for it.
   */
  function testDOMProps(props, obj, elem) {
    var item;

    for (var i in props) {
      if (props[i] in obj) {

        // return the property name as a string
        if (elem === false) {
          return props[i];
        }

        item = obj[props[i]];

        // let's bind a function
        if (is(item, 'function')) {
          // bind to obj unless overriden
          return fnBind(item, elem || obj);
        }

        // return the unbound function or obj or value
        return item;
      }
    }
    return false;
  }

  return testDOMProps;
});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy