MCPcopy Index your code
hub / github.com/codeaashu/claude-code / setAttribute

Function setAttribute

src/ink/dom.ts:247–264  ·  view source on GitHub ↗
(
  node: DOMElement,
  key: string,
  value: DOMNodeAttribute,
)

Source from the content-addressed store, hash-verified

245}
246
247export 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
266export const setStyle = (node: DOMNode, style: Styles): void => {
267 // Compare style properties to avoid marking dirty unnecessarily.

Callers 2

applyPropFunction · 0.85
commitUpdateFunction · 0.85

Calls 1

markDirtyFunction · 0.85

Tested by

no test coverage detected