New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

quelib

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quelib

A small yet useful JS query framework that blends the difference between HTML nodes and NodeLists

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

npm npm bundle size (minified) npm bundle size (minified + gzip) MIT ES2015+

Quelib

As all libs of this kind even this one can do:

$(()=>{/* Do on load */});

// query HTML nodes
let array = $(".query");

//access queried nodes
let node = $(".query")[0];

// and do something with its properties or methods.
$(".query").on("click", ()=>{});

However, why have a limited set of properties and methods to work with? Maybe you want others or all of them. With this lib you can get, set or call all properties or functions defined on queried nodes.

// Disable all .homeButtons
$(".homeButton").disabled = true;

// Get array of ids of buttons with .homeButton class
let array = $(".homeButton").id; 

// Assigns click event handler to all .homeButtons 
$(".homeButton").addEventListener("click", ()=>{/*e.g. Go to homepage*/});

Geting started

Install:

> npm i quelib

Import:

// with a bundler:
import $ from "quelib";

//or in Vanilla JS something like this:
import $ from "./node_modules/quelib/release/quelib.js";
//+ don't forget add type="module" to script tag in html

Or you can use source files in ./src/ to bundle & minify it yourself.

Reference

  • hide()
  • show()
  • toggle()

Aliases

addAlias(alias, property)

Predefined aliases

nameis alias of
on()addEventListener()
off()removeEventListener()

Remarks

Property lookup

By default it looks in nodes' properties first; then, if not found, it looks in prototype chain. To alter this you can:

  • Use prefixes to force one or the other behavior.

    • $ to force lookup on nodes.
    • _ to force lookup in prototype chain (= standart behavior without this lib).

    To change these call setPrefixes(noMagic, magic).

  • Call setPrefixes(noMagic, magic) with noMagic set to empty string.

Usage of proxies restrict this lib to ES2015+ environments.

Keywords

quelib

FAQs

Package last updated on 02 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts