mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Add ignoreElements predicate function option
This commit is contained in:
@ -268,8 +268,12 @@ export class DocumentCloner {
|
||||
for (let child = node.firstChild; child; child = child.nextSibling) {
|
||||
if (
|
||||
child.nodeType !== Node.ELEMENT_NODE ||
|
||||
// $FlowFixMe
|
||||
(child.nodeName !== 'SCRIPT' && !child.hasAttribute(IGNORE_ATTRIBUTE))
|
||||
(child.nodeName !== 'SCRIPT' &&
|
||||
// $FlowFixMe
|
||||
!child.hasAttribute(IGNORE_ATTRIBUTE) &&
|
||||
(typeof this.options.ignoreElements !== 'function' ||
|
||||
// $FlowFixMe
|
||||
!this.options.ignoreElements(child)))
|
||||
) {
|
||||
if (!this.copyStyles || child.nodeName !== 'STYLE') {
|
||||
clone.appendChild(this.cloneNode(child));
|
||||
|
@ -14,6 +14,7 @@ export type Options = {
|
||||
backgroundColor: string,
|
||||
canvas: ?HTMLCanvasElement,
|
||||
foreignObjectRendering: boolean,
|
||||
ignoreElements?: HTMLElement => boolean,
|
||||
imageTimeout: number,
|
||||
logging: boolean,
|
||||
proxy: ?string,
|
||||
|
Reference in New Issue
Block a user