Merge pull request #3439 from almaz-khan/master

Fixed unnecessarily style properties update
pull/3442/head
Rich Harris 5 years ago committed by GitHub
commit 860040a7fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,8 +35,7 @@ export default class StyleAttributeWrapper extends AttributeWrapper {
} else {
const snippet = chunk.render();
add_to_set(prop_dependencies, chunk.dependencies);
add_to_set(prop_dependencies, chunk.dynamic_dependencies());
return chunk.get_precedence() <= 13 ? `(${snippet})` : snippet;
}
})

@ -0,0 +1,47 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_style
} from "svelte/internal";
function create_fragment(ctx) {
var div;
return {
c() {
div = element("div");
set_style(div, "color", color);
},
m(target, anchor) {
insert(target, div, anchor);
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(div);
}
}
};
}
let color = 'red';
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default Component;

@ -0,0 +1,5 @@
<script>
let color = 'red';
</script>
<div style="color: {color}"></div>
Loading…
Cancel
Save