pop
Version:
Pop is a [Hyperapp](https://github.com/hyperapp/hyperapp) / [Ultradom](https://github.com/ultradom/ultradom) spin-off project — yet another micro-framework for creating graphical user interfaces. This is not the final title, but let's go with that for now
36 lines (33 loc) • 697 B
JavaScript
import { clone } from "./clone"
import { updateAttribute } from "./updateAttribute"
export function updateElement(
element,
oldAttributes,
attributes,
lifecycle,
isRecycling,
isSVG
) {
for (var name in clone(oldAttributes, attributes)) {
if (
attributes[name] !==
(name === "value" || name === "checked"
? element[name]
: oldAttributes[name])
) {
updateAttribute(
element,
name,
attributes[name],
oldAttributes[name],
isSVG
)
}
}
var cb = isRecycling ? attributes.oncreate : attributes.onupdate
if (cb) {
lifecycle.push(function() {
cb(element, oldAttributes)
})
}
}