JSFiddle - React, Tailwind, and code Playground
by jquery4u
JavaScript
Assuming your just creating a cache of elements, instead of this:
// storing elements
var video,
canvas,
img,
options = $.extend(defaults, _options);
// build up our video, canvas, and img list
this.each(function(i, el){
el = $(el);
if(el.is('canvas')){
canvas = el;
} else if(el.is('video')){
video = el;
} else if(el.is('img')){
img = el;
}
});
We could do this:
var cache = [],
options = $.extend(defaults, _options);
this.each(function(i, el) {
var $el = $(el);
if ($el.is('video','canvas','img'))
{
cache[el] = $el;
}
});