Yaffs site version 1.1
[yaffs-website] / web / modules / contrib / blazy / js / dblazy.js
index edce4612f5b2d6b1f5da3eaaae95b0d8c20b0eac..ae0cf3e955c4921ca7a12f0944897b8de6eb1535 100644 (file)
   /**
    * Returns a new object after merging two, or more objects.
    *
-   * Or use https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/
-   * Global_Objects/Object/assign.
+   * Inspired by @adamfschwartz, @zackbloom, http://youmightnotneedjquery.com.
    *
    * @name dBlazy.extend
    *
-   * Inspired by @adamfschwartz, @zackbloom, http://youmightnotneedjquery.com.
-   *
    * @param {Object} out
    *   The objects to merge together.
    *
     }
   };
 
+  /**
+   * A simple hasClass wrapper.
+   *
+   * @name dBlazy.hasClass
+   *
+   * @param {Element} el
+   *   The HTML element.
+   * @param {String} name
+   *   The class name.
+   *
+   * @return {bool}
+   *   True if of of the method is supported.
+   */
+  dBlazy.hasClass = function (el, name) {
+    if (el.classList) {
+      return el.classList.contains(name);
+    }
+    else {
+      return el.className.indexOf(name) !== -1;
+    }
+  };
+
   /**
    * A simple wrapper for event delegation like jQuery.on().
    *