X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fblazy%2Fjs%2Fdblazy.js;h=ae0cf3e955c4921ca7a12f0944897b8de6eb1535;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=edce4612f5b2d6b1f5da3eaaae95b0d8c20b0eac;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/modules/contrib/blazy/js/dblazy.js b/web/modules/contrib/blazy/js/dblazy.js index edce4612f..ae0cf3e95 100644 --- a/web/modules/contrib/blazy/js/dblazy.js +++ b/web/modules/contrib/blazy/js/dblazy.js @@ -111,13 +111,10 @@ /** * 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. * @@ -173,6 +170,28 @@ } }; + /** + * 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(). *