Skip to content

data-permanent doesn't apply to the element with that attribute #51021

@SteveSandersonMS

Description

@SteveSandersonMS

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions