From cf8b113e359ec65f40bc25d7378dee35303611d0 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Thu, 6 Jan 2022 21:23:25 +0000 Subject: [PATCH] Fix tests Not all parse tree nodes have an "orderedAttributes" member (eg. the error message generated at https://github.com/Jermolene/TiddlyWiki5/blob/5613bcc8849bd979505eb442c7c2b9b0d2eeff19/core/modules/widgets/transclude.js#L73-L75) --- core/modules/widgets/widget.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index d1c66146d..a0dcff64a 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -314,8 +314,7 @@ excludeEventAttributes: ignores attributes whose name begins with "on" Widget.prototype.assignAttributes = function(domNode,options) { options = options || {}; var self = this; - $tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) { - var name = attribute.name, value = self.getAttribute(name); + var assignAttribute = function(name,value) { // Check for excluded attribute names if(options.excludeEventAttributes && name.substr(0,2) === "on") { value = undefined; @@ -338,7 +337,17 @@ Widget.prototype.assignAttributes = function(domNode,options) { } } } - }); + } + // Not all parse tree nodes have the orderedAttributes property + if(this.parseTreeNode.orderedAttributes) { + $tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) { + assignAttribute(attribute.name,self.getAttribute(attribute.name)); + }); + } else { + $tw.utils.each(self.attributes,function(value,name) { + assignAttribute(name,value); + }); + } }; /*