Shadow DOM hack

22 January 2023 JavaScript Web hack TypeScript

A little code snippet to overwrite the shadow DOM


JavaScript

TypeScript

    const knob: any = Array.from(document.querySelectorAll('ion-range'));

    knob.forEach(element => {
      element.shadowRoot.innerHTML = `<style>.range-knob-a > div{background: blue !important;}</style>`;
    });