lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-1.17.0 vs lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-1.18.0

- old
+ new

@@ -23,12 +23,12 @@ } }; } }; - PoltergeistAgent.prototype.currentUrl = function() { - return window.location.href.replace(/\ /g, '%20'); + PoltergeistAgent.prototype.frameUrl = function() { + return window.location.href; }; PoltergeistAgent.prototype.find = function(method, selector, within) { var el, error, i, j, len, results, results1, xpath; if (within == null) { @@ -97,11 +97,16 @@ PoltergeistAgent.prototype.afterUpload = function(id) { return this.get(id).removeAttribute('_poltergeist_selected'); }; PoltergeistAgent.prototype.clearLocalStorage = function() { - return typeof localStorage !== "undefined" && localStorage !== null ? localStorage.clear() : void 0; + var error; + try { + return typeof localStorage !== "undefined" && localStorage !== null ? localStorage.clear() : void 0; + } catch (error1) { + error = error1; + } }; PoltergeistAgent.prototype.wrapResults = function(result, page_id) { var j, key, len, obj, res, results1, val; this._visitedObjects || (this._visitedObjects = []); @@ -386,14 +391,14 @@ if (this.isDisabled()) { return false; } else if (value === false && !this.element.parentNode.multiple) { return false; } else { - this.trigger('focus', this.element.parentNode); + this.trigger('focus', {}, this.element.parentNode); this.element.selected = value; this.changed(); - this.trigger('blur', this.element.parentNode); + this.trigger('blur', {}, this.element.parentNode); return true; } }; Node.prototype.tagName = function() { @@ -495,18 +500,21 @@ height: rect.height }; return pos; }; - Node.prototype.trigger = function(name, element) { + Node.prototype.trigger = function(name, options, element) { var event; + if (options == null) { + options = {}; + } if (element == null) { element = this.element; } if (Node.EVENTS.MOUSE.indexOf(name) !== -1) { event = document.createEvent('MouseEvent'); - event.initMouseEvent(name, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + event.initMouseEvent(name, true, true, window, 0, options['screenX'] || 0, options['screenY'] || 0, options['clientX'] || 0, options['clientY'] || 0, options['ctrlKey'] || false, options['altKey'] || false, options['shiftKey'] || false, options['metaKey'] || false, options['button'] || 0, null); } else if (Node.EVENTS.FOCUS.indexOf(name) !== -1) { event = this.obtainEvent(name); } else if (Node.EVENTS.FORM.indexOf(name) !== -1) { event = this.obtainEvent(name); } else { @@ -612,5 +620,9 @@ window.__poltergeist = new PoltergeistAgent; document.addEventListener('DOMContentLoaded', function() { return console.log('__DOMContentLoaded'); }); + +if (document.readyState === 'complete') { + console.log('__DOMContentLoaded'); +}