Skip to content

don't cache attribute values #3723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class AttributeWrapper {
const is_select_value_attribute =
name === 'value' && element.node.name === 'select';

const should_cache = (this.node.should_cache() || is_select_value_attribute);
const should_cache = is_select_value_attribute; // TODO is this necessary?

const last = should_cache && block.get_unique_name(
`${element.var.name}_${name.replace(/[^a-zA-Z_$]/g, '_')}_value`
Expand Down
7 changes: 3 additions & 4 deletions test/js/samples/inline-style-unoptimized/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ function create_fragment(ctx) {
let div0;
let t;
let div1;
let div1_style_value;

return {
c() {
div0 = element("div");
t = space();
div1 = element("div");
attr(div0, "style", ctx.style);
attr(div1, "style", div1_style_value = "" + (ctx.key + ": " + ctx.value));
attr(div1, "style", "" + (ctx.key + ": " + ctx.value));
},
m(target, anchor) {
insert(target, div0, anchor);
Expand All @@ -34,8 +33,8 @@ function create_fragment(ctx) {
attr(div0, "style", ctx.style);
}

if ((changed.key || changed.value) && div1_style_value !== (div1_style_value = "" + (ctx.key + ": " + ctx.value))) {
attr(div1, "style", div1_style_value);
if (changed.key || changed.value) {
attr(div1, "style", "" + (ctx.key + ": " + ctx.value));
}
},
i: noop,
Expand Down