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

Unable to fetch <svg> and <g> tags using JSDOM library #3702

Open
bose1413 opened this issue Apr 10, 2024 · 0 comments
Open

Unable to fetch <svg> and <g> tags using JSDOM library #3702

bose1413 opened this issue Apr 10, 2024 · 0 comments

Comments

@bose1413
Copy link

Basic info:

  • Node.js version: ^20.9.0
  • jsdom version: ^16.6.0

Minimal reproduction case

const htmlString = await driver.executeScript("return document.querySelector('<root tag>').outerHTML");
        const dom: DOMWindow = new JSDOM(htmlString, {
          contentType: 'text/html'
        }).window;
        const rootNode = dom.window.document.querySelector(componentVal);

        if (rootNode) {
          console.log('Looping through all child nodes ...');
          const result: Record<string, string[][]> = {};
          await this.traverseNodes(rootNode, [], result, skipCriteria);
          await fsPromises.writeFile(absolutePath, JSON.stringify(result, null, 2));
        }

After reading that JSON file which is created after traversal, I can see there are no tags that ends with 'g' and 'svg', You can see below JSON output for reference

{
"//oj-sp-diagram-builder/div/oj-diagram/svg/g/g/g/g/g/g/svg/foreignobject/oj-sp-diagram-node/div/div/div/div/div/div/oj-menu-button[2]": [
    "title: "
  ],
  "//oj-sp-diagram-builder/div/oj-diagram/svg/g/g/g/g/g/g/svg/foreignobject/oj-sp-diagram-node/div/div/div/div/div/div/oj-menu-button/button[2]": [
    "aria-label: Actions",
    "aria-haspopup: true",
    "role: button",
    "tabindex: -1"
  ],
  "//oj-sp-diagram-builder/div/oj-diagram/svg/g/g/g/g/g/g/svg/foreignobject/oj-sp-diagram-node/div/div/div/div/div/div/oj-menu-button/button/div/oj-menu[2]": [
    "aria-label: Actions"
  ],
  "//oj-sp-diagram-builder/div/oj-diagram/svg/g/g/g/g/g/g/svg/foreignobject/oj-sp-diagram-node/div/div/div/span[7]": [
    "tabindex: -1",
    "role: button",
    "aria-haspopup: menu",
    "aria-label: Add Node To Right"
  ],
}
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