Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
Slotted elements not added to Custom Web Component in iOS

I'm developing a custom web component and when I add options inside via tag, those are not rendered for iOS browsers.

const template = document.createElement('template');

template.innerHTML = `

    <style>
        .my-wrapper {
            height: auto;
            background: #eee;
        }
    </style>

    <div class="my-wrapper">
        <slot name="my-slot"></slot>
    </div>

`;

class MyComponent extends HTMLElement {

    constructor() {
        super()
        .attachShadow({mode:"open"})
        .appendChild(template.content.cloneNode(true));
    }

}

window.customElements.define('my-component', MyComponent);
<my-component>
  <option slot="my-slot">A</option>
  <option slot="my-slot">B</option>
  <option slot="my-slot">C</option>
  <option slot="my-slot">D</option>
</my-component>

Also available in CodePen: https://codepen.io/agarcav/pen/oNEBZRg

This example works in Chrome Desktop. The slotted elements are added to the web component and they expand it.

Screenshot from Chrome Desktop: enter image description here

Is there any needed config in Safari browsers I am missing?

I've googled it but I couldn't find this as a documented bug. According to Can I use the support is 100%;

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It turns out the problem was the tag is not rendered in Safari if it's not inside <select>, <optgroup> or <datalist>. Although it's rendered in Chrome and other browsers.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda