Prototype: save a few lines in Element.Methods.hasClassName
This commit is contained in:
parent
1b8ef5af86
commit
afbef44cd6
|
@ -294,11 +294,8 @@ Element.Methods = {
|
|||
hasClassName: function(element, className) {
|
||||
if (!(element = $(element))) return;
|
||||
var elementClassName = element.className;
|
||||
if (elementClassName.length == 0) return false;
|
||||
if (elementClassName == className ||
|
||||
elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
|
||||
return true;
|
||||
return false;
|
||||
return (elementClassName.length > 0 && (elementClassName == className ||
|
||||
elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))));
|
||||
},
|
||||
|
||||
addClassName: function(element, className) {
|
||||
|
|
Loading…
Reference in New Issue