1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Make fakedom more resilient to non-string data

This commit is contained in:
Jermolene 2016-11-22 20:24:59 +00:00
parent 0f85ca3478
commit c8f7573a23

View File

@ -23,7 +23,7 @@ var bumpSequenceNumber = function(object) {
var TW_TextNode = function(text) { var TW_TextNode = function(text) {
bumpSequenceNumber(this); bumpSequenceNumber(this);
this.textContent = text; this.textContent = text + "";
}; };
Object.defineProperty(TW_TextNode.prototype, "nodeType", { Object.defineProperty(TW_TextNode.prototype, "nodeType", {
@ -66,7 +66,7 @@ TW_Element.prototype.setAttribute = function(name,value) {
if(this.isRaw) { if(this.isRaw) {
throw "Cannot setAttribute on a raw TW_Element"; throw "Cannot setAttribute on a raw TW_Element";
} }
this.attributes[name] = value; this.attributes[name] = value + "";
}; };
TW_Element.prototype.setAttributeNS = function(namespace,name,value) { TW_Element.prototype.setAttributeNS = function(namespace,name,value) {
@ -139,7 +139,7 @@ Object.defineProperty(TW_Element.prototype, "className", {
return this.attributes["class"] || ""; return this.attributes["class"] || "";
}, },
set: function(value) { 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 || ""; return this.attributes.value || "";
}, },
set: function(value) { set: function(value) {
this.attributes.value = value; this.attributes.value = value + "";
} }
}); });