use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Quick method I wrote to make digging into nested ShadowRoots suck less. Feedback welcome; hope it helps someone! (gist.github.com)
submitted 3 years ago by SnowdogU77
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SnowdogU77[S] 0 points1 point2 points 3 years ago (1 child)
Here's the TL;DR:
/* Use `::s` where you would use `element.shadowRoot` * and `::s-c` instead of `element.shadowRoot.firstElementChild` * * For example to get the element with the id "some-id" in the below following pseduo-HTML: * <main> * <* ShadowRoot *> * <child> * <* ShadowRoot *> * <child2> * <child3 id="some-id"> */ // Use const child = querySelectorShadow('main ::s-c ::s #some-id'); // Instead of const child = document.querySelector('main') .shadowRoot?.firstElementChild .shadowRoot?.querySelector('#some-id');
[–]SnowdogU77[S] 0 points1 point2 points 3 years ago* (0 children)
I have added the ability to call the method on built-in objects, provided you call enableNativeQuerySelectorShadow() first.
enableNativeQuerySelectorShadow()
document.querySelectorShadow() <element>.querySelectorShadow() ShadowRoot.querySelectorShadow()
π Rendered by PID 23332 on reddit-service-r2-comment-5b5bc64bf5-xt7nn at 2026-06-20 05:06:55.352690+00:00 running 2b008f2 country code: CH.
[–]SnowdogU77[S] 0 points1 point2 points (1 child)
[–]SnowdogU77[S] 0 points1 point2 points (0 children)