check if the attribute value is different before setting it

pull/3579/head
Tony Crowe 6 years ago
parent 3c5ccf6ee5
commit 552f19b327

@ -86,7 +86,7 @@ export function self(fn) {
export function attr(node: Element, attribute: string, value?: string) { export function attr(node: Element, attribute: string, value?: string) {
if (value == null) node.removeAttribute(attribute); if (value == null) node.removeAttribute(attribute);
else node.setAttribute(attribute, value); else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
} }
export function set_attributes(node: Element & ElementCSSInlineStyle, attributes: { [x: string]: string }) { export function set_attributes(node: Element & ElementCSSInlineStyle, attributes: { [x: string]: string }) {

Loading…
Cancel
Save