From c8f7573a23d5cf6df9fd1186b494afc40c262608 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 22 Nov 2016 20:24:59 +0000 Subject: [PATCH] Make fakedom more resilient to non-string data --- core/modules/utils/fakedom.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/utils/fakedom.js b/core/modules/utils/fakedom.js index 85f57a503..5175cebc5 100755 --- a/core/modules/utils/fakedom.js +++ b/core/modules/utils/fakedom.js @@ -23,7 +23,7 @@ var bumpSequenceNumber = function(object) { var TW_TextNode = function(text) { bumpSequenceNumber(this); - this.textContent = text; + this.textContent = text + ""; }; Object.defineProperty(TW_TextNode.prototype, "nodeType", { @@ -66,7 +66,7 @@ TW_Element.prototype.setAttribute = function(name,value) { if(this.isRaw) { throw "Cannot setAttribute on a raw TW_Element"; } - this.attributes[name] = value; + this.attributes[name] = value + ""; }; TW_Element.prototype.setAttributeNS = function(namespace,name,value) { @@ -139,7 +139,7 @@ Object.defineProperty(TW_Element.prototype, "className", { return this.attributes["class"] || ""; }, set: function(value) { - this.attributes["class"] = value; + this.attributes["class"] = value + ""; } }); @@ -148,7 +148,7 @@ Object.defineProperty(TW_Element.prototype, "value", { return this.attributes.value || ""; }, set: function(value) { - this.attributes.value = value; + this.attributes.value = value + ""; } });