-
Notifications
You must be signed in to change notification settings - Fork 491
Slot element fallback content affects custom element rendering order #664
Comments
@ruphin What happens if you don't import the polyfill at all? Does it work? The |
Everything works fine without the polyfill. The It might be related to a Chrome bug that I found with fallback content in slots. Even without the polyfill Chrome has some wacky behaviour in content selection of slotted content: <!DOCTYPE html>
<my-element>
</my-element>
<template id="element-template">
<slot name="a">
<p>Line one</p>
</slot>
<p>Line two</p>
<p>Line three</p>
</template>
<script>
class MyElement extends HTMLElement {
constructor() {
super();
let template = document.getElementById('element-template');
let content = template.content.cloneNode(true);
this.attachShadow({mode: 'open'});
this.shadowRoot.appendChild(content);
}
}
customElements.define('my-element', MyElement);
</script> Not exactly sure where to report that issue. |
https://crbug.com/683776 , for reference |
Closing per above comment. That CRBug has been addressed in Chromium. |
There seems to be a bug in the v1 polyfill for Chrome (webcomponents-none.js)
Description
When a
<slot>
element with fallback content is placed directly in the root of a Custom Element's<template>
, it alters the rendering order of all content of that element: it will re-order content bottom-to-top.The issue only occurs if the following conditions are met:
<slot>
element is placed in the root of a<template>
<slot>
element has fallback contentReproduction
You can find it deployed here: https://webcomponents.ruph.in/webcomponentsjsbug.html
Browsers affected
Chrome
The text was updated successfully, but these errors were encountered: