JSPM

light-dom-selector

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q17562F
  • License MIT

Extra lightweight DOM selector helper

Package Exports

  • light-dom-selector

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 (light-dom-selector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

light-dom-selector npm downloads

Lightweight dom selector by simple symbols that outputs an SelectorFn instance.

Support Version IE 6+

Install

npm install light-dom-selector
// This module is only offered as a ES Module
import $ from "light-dom-selector";

// Common JS
const $ = require("light-dom-selector")

Select Dom

Note: if the dom is not exist, {element: undefined, constructor: Object} this is the result.

getElementById

$("#app")
// => SelectorFn {element: Element, constructor: Object}

getElementsByClassName

$(".app")
// => SelectorFn {element: Element, constructor: Object}

querySelectorAll

$("*.app h1")
// => SelectorFn {element: Element, constructor: Object}

getElementsByName

$("~h1")
// => SelectorFn {element: Element, constructor: Object}

getElementsByTagName

$("@app")
// => SelectorFn {element: Element, constructor: Object}

Event

on

you can handle event by on method.

$("#app").on("click", function() {
  /// event
});

$("#app").on("click mouseover", function() {
  /// event
});