Created
October 7, 2015 22:23
-
-
Save cdata/e9f1775faeeb3561e587 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Throw on prevent default: | |
| var origPrevDef = KeyboardEvent.prototype.preventDefault; | |
| KeyboardEvent.prototype.preventDefault = function() { | |
| if (this.type !== 'keyup') { | |
| return origPrevDef.apply(this, arguments); | |
| } | |
| throw new Error('Prevent default called on keyboard event.'); | |
| }; | |
| // Break on adding capturing listener: | |
| var origAddEvLis = Node.prototype.addEventListener; | |
| Node.prototype.addEventListener = function(event, handler, capturing) { | |
| if (event === 'keyup' && capturing) { | |
| debugger; | |
| } | |
| return origAddEvList.apply(this, arguments); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment