bigskysoftware / idiomorph

A DOM-merging algorithm
BSD 2-Clause "Simplified" License
675 stars 32 forks source link

How preserve attributes values? #58

Open dannluciano opened 1 month ago

dannluciano commented 1 month ago

How preserve attribute values missed from new content? For example:

let details1 = make('<details open><summary>Details1</summary>Something</details>')
let details2 = make('<details><summary>Details2</summary>Something</details>')

Idiomorph.morph(details1, details2);

should.equal(null, details2.getAttribute("open"));
details1.getAttribute("open").should.equal("");

I want that details1 have openattribute and the content of details2

genezys commented 1 month ago

Did you try with options { morphStyle: 'innerHTML' }?