Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't parse shadowroot element #149

Open
litttley opened this issue Oct 30, 2023 · 1 comment
Open

can't parse shadowroot element #149

litttley opened this issue Oct 30, 2023 · 1 comment

Comments

@litttley
Copy link

for example the github commit relative-time element is a shdowroot ,document.querySelector("#repo-content-pjax-container > div > div > div.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-end.Layout--sidebarPosition-flowRow-end > div.Layout-main > div.Box.mb-3 > div.js-details-container.Details > div.Details-content--hidden-not-important.js-navigation-container.js-active-navigation-container.d-md-block > div.Box-row.Box-row--focus-gray.py-2.d-flex.position-relative.js-navigation-item.navigation-focus > div.color-fg-muted.text-right > relative-time").shadowRoot.textContent the selector can't find out

@b-fuze
Copy link
Owner

b-fuze commented Nov 2, 2023

Yeah, what you describe depends on two things: custom elements and shadowroots. For the shadow roots to exist you must first register the custom element Javascript classes to add the shadowroots. Just parsing the HTML won't yield you shadowroot nodes, you must also run the Javascript on the page in addition parsing the HTML.

Deno DOM is not meant to be a substitute for a browser and by extension will never execute the Javascript on a page. What I do plan on doing, however, is implementing both the custom element API and the shadow root API in Deno DOM. It's just if you parse the HTML from Github for example you won't get any shadow roots created because that's strictly a Javascript feature and can't be expressed in HTML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants