JSPM

domni-search

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q102990F
  • License MIT

A white-label search bar component for filtering DOM nodes based on content.

Package Exports

  • domni-search

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (domni-search) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

DOMni Search

A search bar component for filtering DOM nodes based on content.

Get Started

Include the script:

<script src="https://cdn.jsdelivr.net/npm/domni-search@0.1.0/dist/domni-search.min.js"></script>

Have a host input search element and a couple elements amongst which to search:

<input type="search" />
<ul>
    <li>foo</li>
    <li>foo bar</li>
    <li>foo baz</li>
    <li>bar baz</li>
</ul>

After the page is loades, construct an index of the searchable DOM elements:

var idx = new SearchIndex('div > li');
// Second parameter is a boolean for case sensitivity. Defaults to false (insensitive).

Optionally store some settings in an object:

var settings = {
    delay: 500, // ms to delay search after typing
    any: false // wether to look for elements that match any word
};

And then decorate your input as a Domni Search Bar:

var bar = new SearchBar('input[type=search]', idx, settings);

Reporting Bugs

If you have found any problems with this module, please:

  1. Open an issue.
  2. Describe what happened and how.
  3. Also in the issue text, reference the label ~bug.

We will make sure to take a look when time allows us.

Proposing Features

If you wish to get that awesome feature or have some advice for us, please:

  1. Open an issue.
  2. Describe your ideas.
  3. Also in the issue text, reference the label ~proposal.

Contributing

If you have spotted any enhancements to be made and is willing to get your hands dirty about it, fork us and submit your merge request so we can collaborate effectively.