( node: DOMElement, key: string, value: DOMNodeAttribute, )
| 245 | } |
| 246 | |
| 247 | export const setAttribute = ( |
| 248 | node: DOMElement, |
| 249 | key: string, |
| 250 | value: DOMNodeAttribute, |
| 251 | ): void => { |
| 252 | // Skip 'children' - React handles children via appendChild/removeChild, |
| 253 | // not attributes. React always passes a new children reference, so |
| 254 | // tracking it as an attribute would mark everything dirty every render. |
| 255 | if (key === 'children') { |
| 256 | return |
| 257 | } |
| 258 | // Skip if unchanged |
| 259 | if (node.attributes[key] === value) { |
| 260 | return |
| 261 | } |
| 262 | node.attributes[key] = value |
| 263 | markDirty(node) |
| 264 | } |
| 265 | |
| 266 | export const setStyle = (node: DOMNode, style: Styles): void => { |
| 267 | // Compare style properties to avoid marking dirty unnecessarily. |
no test coverage detected