diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-22 17:09:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-22 17:09:02 -0800 |
commit | 7dfbd9ac5ec8d096cbc147d7693814d2d81568bc (patch) | |
tree | baa38c9f0c8cc62d480ca486cc90b13a755762a2 /src/headless.js | |
parent | 00c0ccc15b36742bdbb472ce09b1eae7616e822f (diff) |
some headless additions
Diffstat (limited to 'src/headless.js')
-rw-r--r-- | src/headless.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/headless.js b/src/headless.js index e5458641..5880c087 100644 --- a/src/headless.js +++ b/src/headless.js @@ -82,6 +82,16 @@ var window = { } listeners.push(func); }, + removeEventListener: function(id, func) { + var listeners = this.eventListeners[id]; + if (!listeners) return; + for (var i = 0; i < listeners.length; i++) { + if (listeners[i] === func) { + listeners.splice(i, 1); + return; + } + } + }, callEventListeners: function(id) { var listeners = this.eventListeners[id]; if (listeners) { @@ -101,6 +111,7 @@ var document = { headless: true, eventListeners: {}, addEventListener: window.addEventListener, + removeEventListener: window.removeEventListener, callEventListeners: window.callEventListeners, getElementById: function(id) { switch(id) { @@ -144,6 +155,7 @@ var document = { }, eventListeners: {}, addEventListener: document.addEventListener, + removeEventListener: document.removeEventListener, callEventListeners: document.callEventListeners, }; }; |