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

136
Visualizações
How to access the library based shadow-dom component and change its style?

I have a component in which I need to change the styles, but in the real dom I am not able to do that, but in the shadow-dom, I can achieve this tried on the console. Whenever I try to access the shadow-dom component it is throwing null error.

let frame = document.getElementsByTagName("iframe")[0];

let sheet = new CSSStyleSheet;

sheet.replaceSync( `.component { position: absolute; top: 0; bottom: 0; left: 0; right: 0; 
height: 100%; width: 100%; }`);

const elemStyleSheets = frame.shadowRoot.adoptedStyleSheets;

frame.shadowRoot.adoptedStyleSheets = [sheet ]

It is showing error in frame.shadowRoot property, that there is no shadowRoot defined, as I am accessing the 3rd party library, so there shadow-dom is defined in the 3rd party library.

Structure for shadow-dom:

<iframe>
  #document >> separate html page
</iframe>
about 4 years ago · Juan Pablo Isaza
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