mirror of https://github.com/sveltejs/svelte
fix: support hydrating elements with properties whose getters throw (#13211)
Fixes #10824 If during hydration a getter of a custom element was called, and that getter throwed, hydration would fail - this makes it not do thatpull/13231/head
parent
1a9d8a509c
commit
80e30f7001
@ -0,0 +1,16 @@
|
||||
<script module>
|
||||
if (!customElements.get('custom-element-with-settable-only-property')) {
|
||||
customElements.define('custom-element-with-settable-only-property', class CustomElement extends HTMLElement {
|
||||
set prop(n) {
|
||||
this.value = n;
|
||||
}
|
||||
|
||||
get prop() {
|
||||
// invoking this getter shouldn't make hydration fail
|
||||
throw new Error('This value is not gettable');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<custom-element-with-settable-only-property prop="8"></custom-element-with-settable-only-property>
|
Loading…
Reference in new issue