// Localize the search to all elements inside elem, as well as elem itself, unless elem === document
var $elem = $(elem).find('[data-'+name+']').addBack('[data-'+name+']').filter(function () {
- return typeof $(this).data("zfPlugin") === "undefined";
+ return typeof $(this).data("zfPlugin") === 'undefined';
});
// For each plugin found, initialize it
var args = Array.prototype.slice.call(arguments, 1);//collect all the arguments, if necessary
var plugClass = this.data('zfPlugin');//determine the class of plugin
- if(plugClass !== undefined && plugClass[method] !== undefined){//make sure both the class and method exist
+ if(typeof plugClass !== 'undefined' && typeof plugClass[method] !== 'undefined'){//make sure both the class and method exist
if(this.length === 1){//if there's only one, call it directly.
plugClass[method].apply(plugClass, args);
}else{
}
// Polyfill to get the name of a function in IE9
function functionName(fn) {
- if (Function.prototype.name === undefined) {
+ if (typeof Function.prototype.name === 'undefined') {
var funcNameRegex = /function\s([^(]{1,})\(/;
var results = (funcNameRegex).exec((fn).toString());
return (results && results.length > 1) ? results[1].trim() : "";
}
- else if (fn.prototype === undefined) {
+ else if (typeof fn.prototype === 'undefined') {
return fn.constructor.name;
}
else {
// Get the new active link
const $oldActive = this.$active;
let activeHash = '';
- if(activeIdx !== undefined){
+ if(typeof activeIdx !== 'undefined'){
this.$active = this.$links.filter('[href="#' + this.$targets.eq(activeIdx).data('magellan-target') + '"]');
if (this.$active.length) activeHash = this.$active[0].getAttribute('href');
}else{
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
- val = val === undefined ? null : decodeURIComponent(val);
+ val = typeof val === 'undefined' ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;