chobitsu icon indicating copy to clipboard operation
chobitsu copied to clipboard

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

Open l3ve opened this issue 2 years ago • 0 comments

https://github.com/liriliri/chobitsu/blob/6156d2b681c8204daf6ee179bcec01243b7e8cfd/src/lib/nodeManager.ts#L73-L77

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

l3ve avatar Jan 13 '23 09:01 l3ve