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

capture slotted elements #179

Closed
wants to merge 2 commits into from
Closed

Conversation

cWenyu
Copy link

@cWenyu cWenyu commented Aug 2, 2024

Fix issue #178

Also fix a typo

@@ -97,8 +97,8 @@
let restorations = [];
return Promise.resolve(node)
.then(ensureElement)
.then(function (clonee) {
return cloneNode(clonee, options, null, ownerWindow);
.then(function (clone) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is NOT a typo, the intent here is to ensure that the clone in scope isn't hidden by this name.

Please revert these two lines

src/dom-to-image-more.js Show resolved Hide resolved
@@ -439,8 +439,14 @@

function getRenderedChildren(original) {
if (util.isShadowSlotElement(original)) {
return original.assignedNodes(); // shadow DOM <slot> has "assigned nodes" as rendered children
const childElement = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're essentially unioning these two arrays... I assume there's no path by which the same nodes appear in both childNodes and assignedNodes (e.g. we're not going to generate duplicate nodes doing this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You gave a good point here, we should not use the union, the assigned nodes actually will cover default content/node(original childNodes). Should use or relation here. I will update the code. Here's my test example:https://jsfiddle.net/CWenyu/wanphkx2/49/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, do you have suggestions on a starting point for the progress bar styling? I've been struggling with that for a few days 😵

@IDisposable
Copy link
Member

Manually merged this in 3.4.0

IDisposable added a commit that referenced this pull request Aug 21, 2024
When the element's  has no assignedNodes, fall-back to the node's childNodes for ShadowSlotElements.
Thanks @cWenyu
Fixes #178, Merges #179
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.

2 participants