lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-1.11.0 vs lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-1.12.0

- old
+ new

@@ -1,20 +1,15 @@ var PoltergeistAgent; PoltergeistAgent = (function() { - PoltergeistAgent.JSON || (PoltergeistAgent.JSON = { - parse: JSON.parse, - stringify: JSON.stringify - }); - function PoltergeistAgent() { this.elements = []; this.nodes = {}; } PoltergeistAgent.prototype.externalCall = function(name, args) { - var error, error1; + var error; try { return { value: this[name].apply(this, args) }; } catch (error1) { @@ -26,36 +21,16 @@ } }; } }; - PoltergeistAgent.stringify = function(object) { - var error, error1; - try { - return PoltergeistAgent.JSON.stringify(object, function(key, value) { - if (Array.isArray(this[key])) { - return this[key]; - } else { - return value; - } - }); - } catch (error1) { - error = error1; - if (error instanceof TypeError) { - return '"(cyclic structure)"'; - } else { - throw error; - } - } - }; - PoltergeistAgent.prototype.currentUrl = function() { return window.location.href.replace(/\ /g, '%20'); }; PoltergeistAgent.prototype.find = function(method, selector, within) { - var el, error, error1, i, j, len, results, results1, xpath; + var el, error, i, j, len, results, results1, xpath; if (within == null) { within = document; } try { if (method === "xpath") { @@ -294,13 +269,14 @@ } return attrs; }; Node.prototype.getAttribute = function(name) { + var ref; if (name === 'checked' || name === 'selected') { return this.element[name]; } else { - return this.element.getAttribute(name); + return (ref = this.element.getAttribute(name)) != null ? ref : void 0; } }; Node.prototype.scrollIntoView = function() { this.element.scrollIntoViewIfNeeded();