Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda