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

[Feat] Included Shadow DOM & First-line PseudoElement #370

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pvillaverde
Copy link

Greetings!

I needed to create an image from an Ionic application, which uses WebComponents with its ShadowDOM.
So I made a change to check if the element has ShadowDOM, use its childrens, otherwise as it were.

I also added the CSS :first-line pseudoElement

[Feat] Included CSS:first-line pseudoElement
ShaMan123 added a commit to ShaMan123/html-to-image that referenced this pull request May 14, 2021
…ements

Inspired by tsayen/dom-to-image#370

If element has `shadowRoot` property it is custom
(and the shadow node is open) so fetch it's children.

Closes bubkoo#128
bubkoo pushed a commit to bubkoo/html-to-image that referenced this pull request May 17, 2021
* feat(custom-elements): ✨ obtain children of shadow node for custom elements

Inspired by tsayen/dom-to-image#370

If element has `shadowRoot` property it is custom
(and the shadow node is open) so fetch it's children.

Closes #128

* fix: 🐛 add safety checks to support special/custom elements

Introduced by 021f124
Access to shadow node exposes the code to custom elements that break the current code.
Was breaking because of elements without a style node.
This commit fixes these bugs with simple, NON-BREAKING safety checks.

* test(htmltoimage): 🚨 Added tests covering custom elements

renders mathfield custom element
https://github.com/arnog/mathlive
@jfbloom22
Copy link

This is exactly the solution I am looking for. Has anyone tested this out successfully?

@ghost
Copy link

ghost commented Aug 19, 2022

Is this library no longer maintained ?

@zm-cttae
Copy link

zm-cttae commented Jan 19, 2023

De-facto yes @bacloud23. If you want Typescript, html-to-image.
If you don't need it and want heavy optimisation, dom-to-image-more.

@ghost
Copy link

ghost commented Jan 19, 2023

thanks a lot 😁

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

Successfully merging this pull request may close these issues.

3 participants