Skip to content
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

Void element 'children' get hydrated #3882

Closed
Rich-Harris opened this issue Nov 9, 2019 · 0 comments · Fixed by #3884
Closed

Void element 'children' get hydrated #3882

Rich-Harris opened this issue Nov 9, 2019 · 0 comments · Fixed by #3884
Labels

Comments

@Rich-Harris
Copy link
Member

Describe the bug
Svelte generates code that hydrates the children of <img> elements and other void elements, even though there can't be any by definition.

To Reproduce
https://svelte.dev/repl/f5c696a56a234934a9556be6a696e5db?version=3.12.1

Expected behavior

	return {
		c() {
			img = element("img");
			this.h()
		},

		l(nodes) {
			img = claim_element(nodes, "IMG", { src: true }, false);
-			var img_nodes = children(img);
-
-			img_nodes.forEach(detach);
			this.h();
		},

		h() {
			attr(img, "src", "donuts.jpg");
		},

Severity
Mostly harmless, but easily fixed

@Rich-Harris Rich-Harris added the bug label Nov 9, 2019
Rich-Harris added a commit that referenced this issue Nov 9, 2019
Rich-Harris added a commit that referenced this issue Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant