MCPcopy Create free account
hub / github.com/Effect-TS/effect / patchAttrs

Function patchAttrs

packages/effect/src/ui/internal/kernel.ts:1957–1978  ·  view source on GitHub ↗
(
  host: Host,
  node: unknown,
  before: Readonly<Record<string, string>>,
  attrs: Readonly<Record<string, string>>
)

Source from the content-addressed store, hash-verified

1955}
1956
1957const patchAttrs = (
1958 host: Host,
1959 node: unknown,
1960 before: Readonly<Record<string, string>>,
1961 attrs: Readonly<Record<string, string>>
1962): void => {
1963 if (sameAttrs(before, attrs)) return
1964 if (host.normalizeAttrs !== undefined) {
1965 before = host.normalizeAttrs(node, before)
1966 attrs = host.normalizeAttrs(node, attrs)
1967 }
1968 for (const name in before) {
1969 if (typeof attrs[name] !== "string") {
1970 host.setAttr(node, name, undefined, before[name])
1971 }
1972 }
1973 for (const name in attrs) {
1974 const value = attrs[name]
1975 const previous = before[name]
1976 if (previous !== value) host.setAttr(node, name, value, previous)
1977 }
1978}
1979
1980const patchProps = (
1981 host: Host,

Callers 1

patchElementFunction · 0.85

Calls 2

sameAttrsFunction · 0.85
setAttrMethod · 0.80

Tested by

no test coverage detected