Precise DOM morphing
morphing typescript dom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update README.md

+11
+11
README.md
··· 72 72 73 73 - **`beforeAttributeUpdated`**: Called before an attribute is updated on an element. Return `false` to prevent the update. 74 74 75 + ```javascript 76 + morph(currentNode, newNode, { 77 + beforeAttributeUpdated: (element, name) => { 78 + if (element.tagName === "DETAILS" && name === "open") return false 79 + return true 80 + }, 81 + }) 82 + ``` 83 + 84 + This can be useful for preserving UI state that your backend does not track, such as whether a `<details>` element is open. 85 + 75 86 - **`afterAttributeUpdated`**: Called after an attribute has been updated on an element. 76 87 77 88 - **`beforeChildrenVisited`**: Called before an element's children are visited during morphing. Return `false` to skip visiting children.