diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 4 | ||||
| -rw-r--r-- | lib/utils.coffee | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 62e655e7..21018049 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -32,8 +32,8 @@ DomUtils = # makeXPath: (elementArray) -> xpath = [] - for i of elementArray - xpath.push("//" + elementArray[i], "//xhtml:" + elementArray[i]) + for element in elementArray + xpath.push("//" + element, "//xhtml:" + element) xpath.join(" | ") evaluateXPath: (xpath, resultType) -> diff --git a/lib/utils.coffee b/lib/utils.coffee index b7f8731a..c8a02328 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -145,6 +145,13 @@ Function::curry = -> Array.copy = (array) -> Array.prototype.slice.call(array, 0) +Array::rotate = (count) -> + if @length + count = count % @length + count += @length while count < 0 + Array::push.apply(this, @splice(0, count)) + this + String::startsWith = (str) -> @indexOf(str) == 0 globalRoot = window ? global |
