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

195
Visualizações
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 à 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