1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-19 08:45:13 +00:00

Genesis widget should pass raw attributes onto child widget...

...so that it can more efficiently handle refreshing itself.
This commit is contained in:
jeremy@jermolene.com
2022-05-07 11:41:28 +01:00
parent c5b10d5c1d
commit 2fe2d20ddf
3 changed files with 39 additions and 15 deletions

View File

@@ -269,12 +269,20 @@ Widget.prototype.getStateQualifier = function(name) {
};
/*
Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed
Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed.
Options include:
filterFn: only include attributes where filterFn(name) returns true
*/
Widget.prototype.computeAttributes = function() {
Widget.prototype.computeAttributes = function(options) {
options = options || {};
var changedAttributes = {},
self = this;
$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {
if(options.filterFn) {
if(!options.filterFn(name)) {
return;
}
}
var value = self.computeAttribute(attribute);
if(self.attributes[name] !== value) {
self.attributes[name] = value;