Trying to inject styles in shadow-dom but element.shadowRoot is always null
SOLVED: Shadow Dom created by the browser cannot be altered.
I am trying to style the timeline of an audio player and need to inject a stylesheet into the shadow-dom to do this (::-webkit are not enough).
edit: Now this codepen
https://codepen.io/fluffybacon-steam/pen/dyENayJ
`
after the page is loaded, I go into the dev console and
player is defined but player-s is always undefined. Its driving me insane because I really don't want to have to make my own player when all I want to do is change some colors.
edit: restored original names
7 Replies
While I would like to know the answer to why shadowRoot is never defined, I must now shill for npm media-chrome for an easily customizer player which I am now using for my needs.
player-s is not even a valid variable name
dash is not valid when variable naming
in JS we follow camelCase notation
first letter of the first word is lowercase
every other first letter of the following words r capital
playerS
about shadowRoot being undefined
doed it meet the 2 criterias?
being made with Element.attachShadow() and the mode option set to open
also where is the the element
d
?sorry that was sloppy... I renamed the variables ad hoc so they'd make sense. I assumed attachShadow() would make a new shadowRoot when all I want to do is alter the original root. Attaching a codepen below
https://codepen.io/fluffybacon-steam/pen/dyENayJ
Uncaught NotSupportedError: Failed to execute 'attachShadow' on 'Element': This element does not support attachShadow
How can element not support attachShadow when it already has a shadow?
I don't think you can access/alter a Shadow Dom created by the browser
#shadow-root (user-agent)
They've build it the way they want it and probably restrict manipulation