Change getElementsAttribute to use Array.map()
Showing
1 changed file
with
2 additions
and
5 deletions
... | @@ -909,12 +909,9 @@ Casper.prototype.getElementsAttr = function getElementsAttr(selector, attribute) | ... | @@ -909,12 +909,9 @@ Casper.prototype.getElementsAttr = function getElementsAttr(selector, attribute) |
909 | "use strict"; | 909 | "use strict"; |
910 | this.checkStarted(); | 910 | this.checkStarted(); |
911 | return this.evaluate(function _evaluate(selector, attribute) { | 911 | return this.evaluate(function _evaluate(selector, attribute) { |
912 | var ele = []; | 912 | return Array.prototype.map.call(__utils__.findAll(selector), function(element) { |
913 | [].forEach.call(__utils__.findAll(selector), function(element) { | 913 | return element.getAttribute(attribute); |
914 | var e = element.getAttribute(attribute); | ||
915 | ele.push(e); | ||
916 | }); | 914 | }); |
917 | return ele; | ||
918 | }, selector, attribute); | 915 | }, selector, attribute); |
919 | } | 916 | } |
920 | 917 | ... | ... |
-
Please register or sign in to post a comment