Last active
August 29, 2015 14:23
-
-
Save KitaitiMakoto/aaaa60ae8cf92d112544 to your computer and use it in GitHub Desktop.
IE10はa要素にtextContentがないとdispatchEventできない
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
var a = document.createElement('a'); | |
a.addEventListener("click", function(event) { | |
console.log(event); | |
}); | |
a.textContent = "click me"; // これがないとIE10でイベント発火しない | |
var evt = document.createEvent('MouseEvents'); | |
evt.initEvent("click", true, true); | |
a.dispatchEvent(evt); | |
console.log(evt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment