js/helpers: add $.hasAttr
Need this for another fix and there is no such jQuery function. As this seems to also be inconsistant across browsers I thought this would definitively be worth a custom jQuery plugin.
This commit is contained in:
parent
0d3fb9e7a5
commit
9ce99bf280
|
@ -95,6 +95,13 @@ if (!Function.prototype.bind) {
|
|||
|
||||
'use strict';
|
||||
|
||||
/* Whether a HTML tag has a specific attribute */
|
||||
$.fn.hasAttr = function(name) {
|
||||
// We have inconsistent behaviour across browsers (false VS undef)
|
||||
var val = this.attr(name);
|
||||
return typeof val !== 'undefined' && val !== false;
|
||||
};
|
||||
|
||||
/* Get class list */
|
||||
$.fn.classes = function (callback) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue