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

allow the el option to accept an HTMLElement instance #1712

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

trusktr
Copy link
Member

@trusktr trusktr commented Jan 5, 2022

Summary

The el docs say

It can be a CSS selector string or an actual HTMLElement.

which wasn't true. This change updates the code to match the docs.

Additionally this allows Docsify to be embedded in custom elements or components systems like React/Vue/Solid/etc where normally people have a reference to an element.

What kind of change does this PR introduce?

Bugfix?
Feature?

For any code change,

  • Related documentation has been updated if needed
  • Related tests have been updated or tests have been added

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

  • Yes
  • No

Related issue, if any:

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE
  • jsdom

@vercel
Copy link

vercel bot commented Jan 5, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/GFgr7UN6pNmBGZEaRQrskSY52E5t
✅ Preview: https://docsify-preview-git-element-value-for-el-option-docsify-core.vercel.app

@trusktr trusktr requested a review from a team January 5, 2022 17:50
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 5, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c8141f7:

Sandbox Source
docsify-template Configuration

This aligns it with what the docs were already saying erroneously, plus
this is useful in cases when people have refs to an element already
(embedding Docsify in a custom element shadow root, or in a React
component that has a ref to the target element, etc).
@trusktr
Copy link
Member Author

trusktr commented Jan 7, 2022

I realized that dom.getNode() has similar logic as what I implemented here. Using that would make this PR shorter.

  • use dom.getNode instead

@trusktr trusktr removed the request for review from a team January 10, 2022 03:42
@trusktr trusktr requested a review from a team January 26, 2022 16:57
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

Successfully merging this pull request may close these issues.

1 participant