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

[Mobile & Electron]Can't get the childNodes in iframe #9

Open
l3ve opened this issue Jan 13, 2023 · 0 comments
Open

[Mobile & Electron]Can't get the childNodes in iframe #9

l3ve opened this issue Jan 13, 2023 · 0 comments

Comments

@l3ve
Copy link

l3ve commented Jan 13, 2023

export function getChildNodes(node: any, depth: number) {
const childNodes = filterNodes(node.childNodes)
return map(childNodes, node => wrap(node, { depth: depth - 1 }))
}

In mobile & electron

When node is iframe,i think the node.childNodes must be node.contentDocument.childNodes

export function getChildNodes(node: any, depth: number) {
  let childNodes = filterNodes(node.childNodes)

  if (
    node.localName === 'iframe' &&
    node?.contentDocument?.childNodes?.length > 0
  ) {
    childNodes = filterNodes(node.contentDocument.childNodes)
  }

  return map(childNodes, node => wrap(node, { depth: depth - 1 }))
}
// Electron need to turn off site-isolation
app.commandLine.appendSwitch('disable-site-isolation-trials')
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

1 participant