1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Fix problem with IE11

It turns out that IE11 has a horrible bug whereby setting the
placeholder attribute before setting the text will trigger an input
event:

https://social.msdn.microsoft.com/Forums/ie/en-US/ae4832b0-8eee-4729-b93
3-a9977ea1b583/internet-explorer-input-event-get-fired-when-settingunset
ting-the-placeholder?forum=iewebdevelopment
This commit is contained in:
Jermolene 2016-05-01 18:17:28 +01:00
parent 037cfb7cc7
commit 01eb45946c
2 changed files with 14 additions and 12 deletions

View File

@ -51,6 +51,13 @@ function FramedEngine(options) {
tag = "input";
}
this.domNode = this.iframeDoc.createElement(tag);
// Set the text
if(this.widget.editTag === "textarea") {
this.domNode.appendChild(this.iframeDoc.createTextNode(this.value));
} else {
this.domNode.value = this.value;
}
// Set the attributes
if(this.widget.editType) {
this.domNode.setAttribute("type",this.widget.editType);
}
@ -65,12 +72,6 @@ function FramedEngine(options) {
}
// Copy the styles from the dummy textarea
this.copyStyles();
// Set the text
if(this.widget.editTag === "textarea") {
this.domNode.appendChild(this.iframeDoc.createTextNode(this.value));
} else {
this.domNode.value = this.value;
}
// Add event listeners
$tw.utils.addEventListeners(this.domNode,[
{name: "input",handlerObject: this,handlerMethod: "handleInputEvent"},

View File

@ -27,6 +27,13 @@ function SimpleEngine(options) {
tag = "input";
}
this.domNode = this.widget.document.createElement(tag);
// Set the text
if(this.widget.editTag === "textarea") {
this.domNode.appendChild(this.widget.document.createTextNode(this.value));
} else {
this.domNode.value = this.value;
}
// Set the attributes
if(this.widget.editType) {
this.domNode.setAttribute("type",this.widget.editType);
}
@ -42,12 +49,6 @@ function SimpleEngine(options) {
if(this.widget.editClass) {
this.domNode.className = this.widget.editClass;
}
// Set the text
if(this.widget.editTag === "textarea") {
this.domNode.appendChild(this.widget.document.createTextNode(this.value));
} else {
this.domNode.value = this.value;
}
// Add an input event handler
$tw.utils.addEventListeners(this.domNode,[
{name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"},