Skip to content

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

@l3ve

Description

@l3ve

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')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions