1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Optimise fake dom

Object.setPrototypeOf() appears to be significantly faster
This commit is contained in:
jeremy@jermolene.com 2022-09-23 18:09:45 +01:00
parent 53d229592d
commit 0a00da6db9

View File

@ -42,7 +42,7 @@ var TW_TextNode = function(text) {
this.textContent = text + ""; this.textContent = text + "";
}; };
TW_TextNode.prototype = Object.create(TW_Node.prototype); Object.setPrototypeOf(TW_TextNode,TW_Node.prototype);
Object.defineProperty(TW_TextNode.prototype, "nodeType", { Object.defineProperty(TW_TextNode.prototype, "nodeType", {
get: function() { get: function() {
@ -67,7 +67,7 @@ var TW_Element = function(tag,namespace) {
this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml"; this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml";
}; };
TW_Element.prototype = Object.create(TW_Node.prototype); Object.setPrototypeOf(TW_Element,TW_Node.prototype);
Object.defineProperty(TW_Element.prototype, "style", { Object.defineProperty(TW_Element.prototype, "style", {
get: function() { get: function() {