Open
Description
I was trying out data-permanent
and was confused for a while because it seemed not to work. Then I tried moving it to an ancestor element and it did work.
Repro
- Start with
<div id='myelem' data-permanent></div>
- Use JS to mutate it in some way (e.g.,
document.getElementById('myelem').classList.toggle('expand')
) - Perform an enhanced nav that returns equivalent content (i.e.,
<div id='myelem' data-permanent></div>
)
Expected: The expand
class should be retained
Actual: It is not
However if you replace the markup with <div data-permanent><div id='myelem'></div></div>
then the class is retained
I guess diffing only uses data-permanent
to decide whether to recurse into the element, but I think it should also use it to decide whether to synchronize the attributes on that element.