Eliminate runtime forking and long method lookup in Element.hasAttribute
.
This commit is contained in:
parent
829800834d
commit
9ef3f8d2ed
@ -1,3 +1,5 @@
|
||||
* Eliminate runtime forking and long method lookup in `Element.hasAttribute`. (kangax)
|
||||
|
||||
* Remove redundant ternary. (kangax)
|
||||
|
||||
* Avoid repeating declaration statements where it makes sense, for slightly better runtime performance and minification. (kangax)
|
||||
|
@ -2036,10 +2036,14 @@ Element.extend = (function() {
|
||||
return extend;
|
||||
})();
|
||||
|
||||
Element.hasAttribute = function(element, attribute) {
|
||||
if (element.hasAttribute) return element.hasAttribute(attribute);
|
||||
return Element.Methods.Simulated.hasAttribute(element, attribute);
|
||||
};
|
||||
if (document.documentElement.hasAttribute) {
|
||||
Element.hasAttribute = function(element, attribute) {
|
||||
return element.hasAttribute(attribute);
|
||||
};
|
||||
}
|
||||
else {
|
||||
Element.hasAttribute = Element.Methods.Simulated.hasAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Element.addMethods(methods) -> undefined
|
||||
|
Loading…
Reference in New Issue
Block a user