diff --git a/core/modules/widgets/select.js b/core/modules/widgets/select.js index 79c014265..68f966842 100644 --- a/core/modules/widgets/select.js +++ b/core/modules/widgets/select.js @@ -169,7 +169,7 @@ SelectWidget.prototype.execute = function() { if(this.selectTooltip) { $tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip); } - this.updateParseTreeDataAttributes(selectNode); + this.assignAttributesToParseTreeNode(selectNode); this.makeChildWidgets([selectNode]); }; diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 5a842a772..9ba94913e 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -458,6 +458,21 @@ Widget.prototype.assignAttributes = function(domNode,options) { }); }; +/* +Set the data- and style. attributes of a parse tree node according to the attributes of the widget +domNode: optional domNode to be assigned +*/ +Widget.prototype.assignAttributesToParseTreeNode = function(parseTreeNode) { + var self = this; + var DATA_ATTRIBUTE_PREFIX = "data-", + STYLE_ATTRIBUTE_PREFIX = "style."; + $tw.utils.each(this.attributes,function(value,name) { + if(name.substr(0,DATA_ATTRIBUTE_PREFIX.length) === DATA_ATTRIBUTE_PREFIX || name.substr(0,STYLE_ATTRIBUTE_PREFIX.length) === STYLE_ATTRIBUTE_PREFIX) { + $tw.utils.addAttributeToParseTreeNode(parseTreeNode,name,value); + } + }); +}; + /* Get the number of ancestor widgets for this widget */ @@ -813,20 +828,6 @@ Widget.evaluateVariable = function(widget,name,options) { return result; }; -/* -Set the data- attributes of a parse tree node according to the attributes of the widget -domNode: optional domNode to be assigned -*/ -Widget.prototype.updateParseTreeDataAttributes = function(parseTreeNode) { - var self = this; - var DATA_ATTRIBUTE_PREFIX = "data-"; - $tw.utils.each(this.attributes,function(value,name) { - if(name.substr(0,DATA_ATTRIBUTE_PREFIX.length) === DATA_ATTRIBUTE_PREFIX) { - $tw.utils.addAttributeToParseTreeNode(parseTreeNode,name,value); - } - }); -}; - exports.widget = Widget; })(); diff --git a/editions/tw5.com/tiddlers/widgets/SelectWidget.tid b/editions/tw5.com/tiddlers/widgets/SelectWidget.tid index e22fcfec6..210b1d823 100644 --- a/editions/tw5.com/tiddlers/widgets/SelectWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/SelectWidget.tid @@ -1,6 +1,6 @@ caption: select created: 20131024141900000 -modified: 20211108165037846 +modified: 20231113093304323 tags: TriggeringWidgets Widgets title: SelectWidget type: text/vnd.tiddlywiki @@ -42,6 +42,9 @@ The content of the `<$select>` widget should be one or more HTML `