Voog / wysihtml

Open source rich text editor for the modern web
http://wysihtml.com
MIT License
3.36k stars 337 forks source link

extending ElementPrototype not working in IE11 #114

Open dzader opened 9 years ago

dzader commented 9 years ago

Not sure if this affects any other browsers - but I don't seem to be having this issue in OSX Chrome and Firefox.

The ElementPrototype.matches function for some reason is not being defined so the dom.domNode.test function is failing on

5813 if (properties.query) { 5814 if (!node.matches(properties.query)) { 5815 return false; 5816 } 5817 }

I am seeing it fail in formatBlock.state in the callback passed to filterElements.

If I manually run document.createElement('P') then .matches is defined but it is not defined on the elements being passed by filterElements.

pulges commented 9 years ago

I have troubles creating this error. Can You give a detailed guide how to create it or even better add a failing test to qUnit test if possible?

sgringwe commented 9 years ago

I am also experiencing this issue on IE11 on 8.1. Investigating found that the Element.matches function is being defined. Using it in the console worked as expected. However, I get the same error on the same line. For me I can easily replicate by highlighting a word in the composer and clicking on bold, italics. Sometimes even when simply highlighting and not performing any actions the code runs and errors. The node variable is of type HTMLPhraseElement.

The stacktrace is:

test:5814
Anonymous function
wysihtml5.commands.formatBlock.state:11693
state:10976
_updateLinkStates:14887
_execCommand:14775
execCommand:14766
Anonymous function
callback:5690
sgringwe commented 9 years ago

@pulges update: this error happens now whenever i click on the text box using the beta-3

inukshuk commented 8 years ago

I have only glanced at this, but I'm pretty sure this only happens when using the editor in an iFrame -- there are probably two separate instances of Element.prototype and only one of them is polyfilled or something along those lines.