allow the `el` option to accept an `HTMLElement` instance
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,
- [x] Related documentation has been updated if needed
- [x] Related tests have been updated or tests have been added
Does this PR introduce a breaking change? (check one)
- [ ] Yes
- [x] No
Related issue, if any:
Tested in the following browsers:
- [x] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Edge
- [ ] IE
- [x] jsdom
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
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 c8141f76737fe76f6746211294e0ab98a47ec59d:
| Sandbox | Source |
|---|---|
| docsify-template | Configuration |
I realized that dom.getNode() has similar logic as what I implemented here. Using that would make this PR shorter.
- [ ] use dom.getNode instead