-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
itemscope are removed from markup #8413
Comments
We are also seeing different behaviours across Firefox ( Chrome:
Firefox
The AST looks the same in all cases. Not sure if this is a red herring but something noticed during debugging. |
This works as a workaround (in the repl): <script>
import { onMount } from 'svelte'
import {
attr,
element
} from "svelte/internal";
let h1 = element('h1')
let name = 'world';
onMount(() => attr(h1, 'itemscope', 'true'))
</script>
<h1 bind:this={h1} >Hello {name}!</h1> Using plain JavaScript to accomplish the same thing also works, but the |
Both of these attributes are set, except as foreign attributes (e.g. This is the specific commit that adds these attributes as It seems? Svelte relies on the browser to set these as attributes when the attributes are declared as properties of the element. This could explain the discrepancy between engines with the Edit: Morning walk cleared it up. Ref: #8414 |
This should be fixed in 3.58.0. |
Describe the bug
When createing a div element with the attribute
itemscope
, the attributeitemscope
is removed from markup and only available as a property. Itemscope as an attrbute is necessary for microdata to work properly. Itemscope is a standard html attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemscopeReproduction
In repl. Set the attribute
itemscope
on the h1-element. Inspect the markup and the attribute is removed.We can expand the test to recreate the bug:
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: