diff --git a/CHANGELOG.md b/CHANGELOG.md index 0088e4b0b395..d6fcc626c8c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Support nullish coalescing (`??`) and optional chaining (`?.`) operators ([#1972](https://github.com/sveltejs/svelte/issues/1972)) * Support `import.meta` ([#4379](https://github.com/sveltejs/svelte/issues/4379)) +* Fix only setting `` values when they're changed when there are spread attributes ([#4418](https://github.com/sveltejs/svelte/issues/4418)) * Fix placement of `{@html}` when used at the root of a slot, at the root of a component, or in `` ([#5012](https://github.com/sveltejs/svelte/issues/5012), [#5071](https://github.com/sveltejs/svelte/pull/5071)) * Fix certain handling of two-way bound `contenteditable` elements ([#5018](https://github.com/sveltejs/svelte/issues/5018)) * Fix handling of `import`ed value that is used as a store and is also mutated ([#5019](https://github.com/sveltejs/svelte/issues/5019)) diff --git a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts index 86b67ca47e37..ec281648b895 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts @@ -7,8 +7,9 @@ import { b, x } from 'code-red'; import Expression from '../../../nodes/shared/Expression'; import Text from '../../../nodes/Text'; import handle_select_value_binding from './handle_select_value_binding'; +import { Identifier, Node } from 'estree'; -export default class AttributeWrapper { +export class BaseAttributeWrapper { node: Attribute; parent: ElementWrapper; @@ -21,7 +22,29 @@ export default class AttributeWrapper { parent.not_static_content(); block.add_dependencies(node.dependencies); + } + } + + render(_block: Block) {} +} +export default class AttributeWrapper extends BaseAttributeWrapper { + node: Attribute; + parent: ElementWrapper; + metadata: any; + name: string; + property_name: string; + is_indirectly_bound_value: boolean; + is_src: boolean; + is_select_value_attribute: boolean; + is_input_value: boolean; + should_cache: boolean; + last: Identifier; + + constructor(parent: ElementWrapper, block: Block, node: Attribute) { + super(parent, block, node); + + if (node.dependencies.size > 0) { // special case —