docsifyjs / docsify

🃏 A magical documentation site generator.
https://docsify.js.org
MIT License
27.78k stars 5.68k forks source link

Fix: fix collapse selector #2113

Closed Embers-of-the-Fire closed 1 month ago

Embers-of-the-Fire commented 1 year ago

Summary

The initial selector uses element.nextSibling, which may select an empty #text on Chromium-based browsers.

Here is an instance:

For a link in the sidebar, it usually seems like this:

<li>
    <a href="link" title="foo">foo</a>
    <ul class="app-sub-sidebar">...</ul>
</li>

The collapsing function uses element.nextSibling to check if collapsing is needed. However, in Chromium-based browsers, a blank text tag will possibly be inserted, making the directory unable to collapse.

bug

What kind of change does this PR introduce?

For any code change,

This is a small fix so there's no test related.

Does this PR introduce a breaking change? (check one)

Tested in the following browsers:

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 11:51am
Embers-of-the-Fire commented 1 year ago

Eee, I don't know why the ci failed, as I've tested it locally and there's no error.

trusktr commented 1 year ago

Hello, thanks!

Eee, I don't know why the ci failed, as I've tested it locally and there's no error.

It didn't fail, I had to hit approve to make ci run.

Koooooo-7 commented 1 month ago

Hi @Embers-of-the-Fire ,sorry for the delay, could you plz solve the conflict and I will do the merge asap. Thx in advance.

Embers-of-the-Fire commented 1 month ago

@Koooooo-7 It has been such long time that the structure of docsify has already changed a lot :(. The bug and the code are all re-written. It seems that the bug is fixed by someone else.