html2canvas-pro 2.3.4 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 2.3.4 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 2.3.5 <https://yorickshan.github.io/html2canvas-pro/>
3
3
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
4
4
  * Released under MIT License
5
5
  */
@@ -8183,18 +8183,29 @@ const LIST_OWNERS = [
8183
8183
  const parseNodeTree = (context, node, parent, root) => {
8184
8184
  for (let childNode = node.firstChild, nextNode; childNode; childNode = nextNode) {
8185
8185
  nextNode = childNode.nextSibling;
8186
- if (isTextNode(childNode) && childNode.data.length > 0) parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
8187
- else if (isElementNode(childNode)) if (isSlotElement(childNode) && childNode.assignedNodes) childNode.assignedNodes().forEach((assignedNode) => parseNodeTree(context, assignedNode, parent, root));
8188
- else {
8189
- const container = createContainer(context, childNode);
8190
- if (container.styles.isVisible()) {
8191
- if (createsRealStackingContext(childNode, container, root)) container.createsRealStackingContext = true;
8192
- else if (createsStackingContext(container.styles)) container.createsStackingContext = true;
8193
- if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) container.isListOwner = true;
8194
- parent.elements.push(container);
8195
- if (childNode.shadowRoot) parseNodeTree(context, childNode.shadowRoot, container, root);
8196
- else if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) parseNodeTree(context, childNode, container, root);
8197
- }
8186
+ parseChildNode(context, childNode, parent, root);
8187
+ }
8188
+ };
8189
+ /**
8190
+ * Parse a single node as a child of `parent`.
8191
+ *
8192
+ * Separated from the tree walk so that nodes assigned to a `<slot>` (including
8193
+ * bare text nodes, which have no child nodes) can be parsed directly. Without
8194
+ * this, slotted shadow-DOM content such as web component labels was silently
8195
+ * dropped because `parseNodeTree` only iterates `node.firstChild` (issue #226).
8196
+ */
8197
+ const parseChildNode = (context, childNode, parent, root) => {
8198
+ if (isTextNode(childNode) && childNode.data.length > 0) parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
8199
+ else if (isElementNode(childNode)) if (isSlotElement(childNode) && childNode.assignedNodes) childNode.assignedNodes().forEach((assignedNode) => parseChildNode(context, assignedNode, parent, root));
8200
+ else {
8201
+ const container = createContainer(context, childNode);
8202
+ if (container.styles.isVisible()) {
8203
+ if (createsRealStackingContext(childNode, container, root)) container.createsRealStackingContext = true;
8204
+ else if (createsStackingContext(container.styles)) container.createsStackingContext = true;
8205
+ if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) container.isListOwner = true;
8206
+ parent.elements.push(container);
8207
+ if (childNode.shadowRoot) parseNodeTree(context, childNode.shadowRoot, container, root);
8208
+ else if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) parseNodeTree(context, childNode, container, root);
8198
8209
  }
8199
8210
  }
8200
8211
  };