Skip to content

Query Throws when the element exists #224

@L1lith

Description

@L1lith

I try running this query but it seems to fail incorrectly.

doc.querySelector(".band:nth-of-type(3) .col-md-4:nth-of-type(2) h2")

Error Message:

TypeError: Cannot read properties of null (reading 'length')
    at nthOfType (/Users/ADMIN/projects/melonjs.org/node_modules/css-select/lib/pseudo-selectors/filters.js:81:42)
    at cachedDescendant (/Users/ADMIN/projects/melonjs.org/node_modules/css-select/lib/general.js:71:55)
    at tag (/Users/ADMIN/projects/melonjs.org/node_modules/css-select/lib/general.js:48:60)
    at cachedDescendant (/Users/ADMIN/projects/melonjs.org/node_modules/css-select/lib/general.js:71:55)
    at tag (/Users/ADMIN/projects/melonjs.org/node_modules/css-select/lib/general.js:48:60)
    at findOne (/Users/ADMIN/projects/melonjs.org/node_modules/node-html-parser/dist/matcher.js:68:13)
    at findOne (/Users/ADMIN/projects/melonjs.org/node_modules/node-html-parser/dist/matcher.js:74:24)
    at findOne (/Users/ADMIN/projects/melonjs.org/node_modules/node-html-parser/dist/matcher.js:74:24)
    at findOne (/Users/ADMIN/projects/melonjs.org/node_modules/node-html-parser/dist/matcher.js:74:24)
    at findOne (/Users/ADMIN/projects/melonjs.org/node_modules/node-html-parser/dist/matcher.js:74:24)

When I run the same query in my browser while browsing the HTML page, it returns the <h2> element successfully.

Relevant source code & HTML files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions