question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a specific reason the shadowRoot is closed in the web component?

I’m using adopted stylesheets to reset the default width & height to inherit so I can just adjust with classes, and it’s working fine, but I’m curious if there was a reason it was closed, and if it would make more sense to open it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cyberaliencommented, Oct 8, 2022

Remembered why it was done: component rendered only 2 nodes: style + icon. When updating child elements, it assumed that first element is style and second is icon, so adding extra code could mess it up.

I’ve updated code to handle it differently, so custom code should not cause problems and opened shadowRoot. Will release new version later today.

0reactions
chasegiuntacommented, Oct 9, 2022

Working on my end!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShadowRoot.mode - Web APIs | MDN
The mode read-only property of the ShadowRoot specifies its mode — either open or closed . This defines whether or not the shadow...
Read more >
html - What is shadow root
This is a special indicator that a Shadow DOM exists. These have existed for years, but developers have never been given APIs into...
Read more >
Open vs. Closed Shadow DOM - RevillWeb
We can interact with the shadow root just like we would any DOM tree. For example we could use: this.shadowRoot.querySelector("p");. To query ...
Read more >
What is shadow root and how to use it
“open” – open means that you can access the shadow DOM using JavaScript. For example using the Element.shadowRoot property: let myShadowDom ...
Read more >
5. Working with the Shadow DOM - Modern JavaScript [Book]
A shadow host is a DOM node that contains a shadow root. ... but most applications leverage open source libraries such as jQuery...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found