luna-dom-viewer

liriliri
esm Styles
luna-dom-viewer JS library on GitHub luna-dom-viewer JS library on npm Download luna-dom-viewer JS library

Dom tree navigator

Version 1.8.2 License MIT Vulnerabilities 0
luna-dom-viewer has no homepage
luna-dom-viewer JS library on GitHub
luna-dom-viewer JS library on npm
Download luna-dom-viewer JS library
Keywords
ui

Luna Dom Viewer

Dom tree navigator.

Demo

https://luna.liriliri.io/?path=/story/dom-viewer

Install

Add the following script and style to your page.

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-dom-viewer/luna-dom-viewer.css" />
<script src="//cdn.jsdelivr.net/npm/luna-dom-viewer/luna-dom-viewer.js"></script>

You can also get it on npm.

npm install luna-dom-viewer --save
import 'luna-dom-viewer/luna-dom-viewer.css'
import LunaDomViewer from 'luna-dom-viewer'

Usage

const container = document.getElementById('container')
const domViewer = new LunaDomViewer(container)
domViewer.expand()

Configuration

  • hotkey(boolean): Enable hotkey.
  • ignore(AnyFn): Predicate function which removes the matching child nodes.
  • ignoreAttr(AnyFn): Predicate function which removes the matching node attributes.
  • lowerCaseTagName(boolean): Whether to convert tag name to lower case.
  • node(ChildNode): Html element to navigate.
  • observe(boolean): Observe dom mutation.

Api

select(node?: ChildNode): void

Select given node.