Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improved getAttribute check, the faster version is now applied to non…

… html documents, as it was before
  • Loading branch information...
commit d3aef7cb747c127f2dd33a608769678ed4e7f9ef 1 parent 4c916e5
@fabiomcosta fabiomcosta authored
Showing with 12 additions and 12 deletions.
  1. +12 −12 Source/Slick.Finder.js
View
24 Source/Slick.Finder.js
@@ -156,6 +156,18 @@ local.setDocument = function(document){
testRoot.removeChild(testNode);
testNode = selected = testRoot = null;
+ // getAttribute
+
+ this.getAttribute = (this.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){
+ var method = this.attributeGetters[name];
+ if (method) return method.call(node);
+ var attributeNode = node.getAttributeNode(name);
+ return (attributeNode) ? attributeNode.nodeValue : null;
+ } : function(node, name){
+ var method = this.attributeGetters[name];
+ return (method) ? method.call(node) : node.getAttribute(name);
+ };
+
// hasAttribute
this.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute) {
@@ -197,18 +209,6 @@ local.setDocument = function(document){
return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
} : null ;
- // get attribute
-
- this.getAttribute = (brokenFormAttributeGetter) ? function(node, name){
- var method = this.attributeGetters[name];
- if (method) return method.call(node);
- var attributeNode = node.getAttributeNode(name);
- return (attributeNode) ? attributeNode.nodeValue : null;
- } : function(node, name){
- var method = this.attributeGetters[name];
- return (method) ? method.call(node) : node.getAttribute(name);
- };
-
this.getUID = (this.isHTMLDocument) ? this.getUIDHTML : this.getUIDXML;
root = null;
Please sign in to comment.
Something went wrong with that request. Please try again.