A Div with Display:None Which Has Several Filter Run Steps Inside

I have a conditional div as below

<div style=<<condition>> >
a  script with several filter runs
</div>

The condition is changed programmatically or by user interaction! and generates display:none and hide the div output!

My question is: when div is hidden, does it mean Tiddlywiki will not compute the filter? or Tiddlywiki does the computation but browser only do not render the output!

I want to know the impact on performance! Does such hidden div makes TW reacts slow?

The filters will still be computed. The <div style=...> only hides the output.

To achieve a performance improvement, you could replace the <div style=<<condition>> >...</div> with a <$list> widget that uses a filter to decide if the inner contents (i.e., the other filters) will be computed.

Something like this:

<$list filter="[<condition>!match[display:none]]" variable="show_or_hide">
... your filters here ...
</$list>

Of course, it will still be calculating the condition itself. Note that the <$list> widget uses variable="..." to prevent it from changing the value of <<currentTiddler>>. Also, since the name of the variable doesn’t matter… my convention is to use the name to describe what the <$list> is doing.

1 Like

What if we use reveal widget? Is reveal widget lighter than a filter run?

Thank you very much Eric. I need to modify some of my codes :slightly_frowning_face: