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

DOMException: Failed to execute 'querySelector' on 'Document': '.vp=sidebar xxx' is not a valid selector #3222

Open
1 task done
tzfun opened this issue Jun 17, 2024 · 0 comments

Comments

@tzfun
Copy link

tzfun commented Jun 17, 2024

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

Normal use will result in an error.

5c962046-50c7-4219-8fdc-19dba7e081c3

I found the problem in the source code.

File position:

node_modules/.pnpm/@vuepress+theme-default@2.0.0-rc.35_vuepress@2.0.0-rc.13/node_modules/@vuepress/theme-default/lib/client/components/VPSidebarItems.vue

Bug:
efff0b6e-0569-41fd-854d-09c730f9fa0d

Fix:

     // get the active sidebar item DOM, whose href equals to the current route
      const activeSidebarItem = document.querySelector(
        `.vp-sidebar a.vp-sidebar-item[href="${route.path}${hash}"]`,
      )

Simply: the selector is .vp-sidebar, not .vp=sidebar

Other relevant information

  • Output of npx vuepress info in my VuePress project:
  System:
    OS: Windows 10 10.0.19045
    CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
    Memory: 16.38 GB / 31.94 GB
  Binaries:
    Node: 22.2.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - D:\nodejs\node_global\yarn.CMD
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 7.20.0 - ~\AppData\Local\pnpm\pnpm.EXE
    bun: Not Found
  Utilities:
    Git: 2.27.0.
  Browsers:
    Chrome: 125.0.6422.142
    Edge: Chromium (126.0.2592.56)
  npmPackages:
    @vuepress/bundler-vite: ^2.0.0-rc.13 => 2.0.0-rc.13
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli: Not Found
    @vuepress/client: ^2.0.0-rc.13 => 2.0.0-rc.13
    @vuepress/core: Not Found
    @vuepress/markdown: Not Found
    @vuepress/shared: Not Found
    @vuepress/utils: 2.0.0-rc.13 => 2.0.0-rc.13
    vue: ^3.4.0 => 3.4.27
    vue-router: Not Found
    vuepress: ^2.0.0-rc.13 => 2.0.0-rc.13
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