Merge pull request #3579 from tcrowe/set-attribute-only-if-different

Prevent image flicker and reloading by checking attribute before setting it
pull/3727/head
Rich Harris 5 years ago committed by GitHub
commit 99911c31f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -86,7 +86,7 @@ export function self(fn) {
export function attr(node: Element, attribute: string, value?: string) {
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 }) {

Loading…
Cancel
Save