vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.48k stars 1.86k forks source link

Aside outline is not rendered #3838

Closed Akaiamerin closed 2 weeks ago

Akaiamerin commented 2 weeks ago

Describe the bug

Uncaught (in promise) DOMException: Failed to execute 'querySelectorAll' on 'Document': '.VPDoc :where(h1,h2,h3,h4,h5,h6)' is not a valid selector.
    at getHeaders (http://localhost:5173/@fs/E:/vitepress/node_modules/vitepress/dist/client/theme-default/composables/outline.js?v=f971accd:16:21)
    at http://localhost:5173/@fs/E:/vitepress/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js?v=f971accd:12:25
    at http://localhost:5173/@fs/E:/vitepress/node_modules/vitepress/dist/client/app/components/Content.js?v=f971accd:4:62
    at Array.forEach (<anonymous>)
    at runCbs (http://localhost:5173/@fs/E:/vitepress/node_modules/vitepress/dist/client/app/components/Content.js?v=f971accd:4:46)
    at callWithErrorHandling (http://localhost:5173/@fs/E:/vitepress/.vitepress/cache/deps/chunk-5QLTCEDZ.js?v=f971accd:1659:19)
    at callWithAsyncErrorHandling (http://localhost:5173/@fs/E:/vitepress/.vitepress/cache/deps/chunk-5QLTCEDZ.js?v=f971accd:1666:17)
    at invokeVNodeHook (http://localhost:5173/@fs/E:/vitepress/.vitepress/cache/deps/chunk-5QLTCEDZ.js?v=f971accd:8880:3)
    at Array.<anonymous> (http://localhost:5173/@fs/E:/vitepress/.vitepress/cache/deps/chunk-5QLTCEDZ.js?v=f971accd:7498:19)
    at flushPostFlushCbs (http://localhost:5173/@fs/E:/vitepress/.vitepress/cache/deps/chunk-5QLTCEDZ.js?v=f971accd:1841:41)

Reproduction

The console on each page shows this message.

Expected behavior

Hopefully it will be considered compatible with older browsers that do not support :where selector.

System Info

Chrome: 86.0.4240.198

Additional context

https://github.com/vuejs/vitepress/blob/a0f7b94953baa367e99e4979140eb99b273aff52/src/client/theme-default/composables/outline.ts#L28

suggestion: ...document.querySelectorAll('.VPDoc h1, .VPDoc h2, .VPDoc h3, .VPDoc h4, .VPDoc h5, .VPDoc h6')

Validations

brc-dd commented 2 weeks ago

Only Chrome/Edge >= 88, Firefox >= 78, Safari >= 14 are supported. We won't be supporting legacy browser versions.