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

196
Vistas
Reverse QuerySelector, to get from the element to its inheriting styles

Currently, I'm building an Application that generates from a JSON File, CSS selectors, and styles. I'm currently Attempting to get all styles affecting an element, I have a solution currently which is not good. Currently, every one of my selectors sets the same custom variable with inheriting false, to its id, then I loop through the element and remove depending on what the id is that variable from the id until it's empty again, then I add them back to each CSS selector and use the array I've got.

This solution is bad since it's forcing a lot of reflows when I remove the variable and it scales linearly, but also it's getting slower and slower as more children the element has.

I could get All affecting elements at launch by just looping each selector with query selector, but when I add an element after it started up it would be way too expensive to run query selector for each CSS selector for each element I add and compare them.

Another solution might be writing a reverse algorithm but with that one, it would be extremely complicated due to the sheer complexity of all selectors like nth-child, first, element, by attribute, etc.-

Any thoughts?

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