8000 Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '[epub:type]' is not a valid selector. · Issue #117 · readium/ts-toolkit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '[epub:type]' is not a valid selector. #117

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

Open
JayPanoz opened this issue Mar 19, 2025 · 2 comments

Comments

@JayPanoz
Copy link
Contributor

This can be reproduced while clicking on subtitles in the chapter headings of this publication for instance e.g.

<p epub:type="title">A Day Behind the Counter</p>

NextJS gives more details:

SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '[epub:type]' is not a valid selector.
src/readium/ts-toolkit/navigator/dist/index.js (4012:59) @ getCssSelector

  4010 |       targetElement: t.target.outerHTML,
  4011 |       interactiveElement: (r = cA(t.target)) == null ? void 0 : r.outerHTML,
> 4012 |       cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(t.target)
       |                                                           ^
  4013 |     }), this.pointerMoved = !1;
  4014 |   }
@JeanSebTr
Copy link

I stumbled upon this error in our reporting tools yesterday!

From what I could understand, there's 2 issues with that selector:

  • per the spec, the correct syntax for an xml namespace prefix in querySelector would be [epub|type]
  • but most (all?) browsers don't actually support specifying a namespace, so just [*|type] is allowed

Also [type] only returns nodes with type attribute from the main namespace, while [*|type] do include all namespaces in the search.

@oscar-rivera-demarque
Copy link
Contributor

As I commented in the meeting, it's possible that the error is related to a few of different errors I was having also when "click/tap" into publications with custom values, like the x-lang attributes.
As far i could debug that time, seems to be related to something here:

// https://unpkg.com/css-selector-generator@3.6.4/build/index.js

because it's using the wrong version (3.6.4) instead of the actual version which namespaces support (3.6.9)
If there is necessary in a couple of weeks I can get back here and try to take a look into the problem (as seems something similar as the one I solved for the navigator-injectables)

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

3 participants
0