npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simple-query

v2.0.3

Published

Lightweight implementation of jQuery api subset

Downloads

2

Readme

SimpleQuery

Build Status Coverage Status NPM Status

Lightweight implementation of jQuery api subset. Designed as a thin wrapper around native browser apis. SimpleQuery is a small and fast library that you already know how to use.

Visit documentation site.

SimpleQuery core functionality will cost you less than 1KB. Import or require modules as you need them. Need to manipulate element classes? Require "classes" module and toggle classes with jQuery api you are probably already familiar with.

Keep in mind that SimpleQuery does not do all that jQuery does. By design this library is a thin wrapper of browser native apis. Because of that selecting elements will work only as good as native .querySelectorAll() does - as there is no custom selector engine implementation. What works with SimpleQuery will work with jQuery - other way may not always be true. At any time you can switch to jQuery and keep your application running.

This library is best used for applications which require small javascript footprint and have a strict performance budget. SimpleQuery is running on traffic heavy web application where jQuery is loaded as polyfill only when browser support is not good enough.

Examples

Import library for usage

var $ = require('simple-query');

Import modules needed for work you want to do:

// require classes, attributes and ajax functionality
require('simple-query/src/classes');
require('simple-query/src/attributes');
require('simple-query/src/ajax');

Profit:

// Manipulate classes
$('p.text').addClass('foo').toggleClass('bar');

// Manipulate Attributes
$('p.text').each(function() {
    console.log($(this).attr('title'));
});

// Get html from server and manipulate html
$.get('/test-html').done(function(html) {
    $('.content').html(html);
});

Full set of examples is available in tests codebase where you see what can and cannot be done with SimpleQuery api.

Modules

SimpleQuery functionality can be extended with following modules:

  • Ajax: get and post data from server
  • Attribute: get and set element attributes
  • Classes: add, remove and toggle element classes
  • CSS: get and set element style values
  • Data: manipulate with data attributes of elements
  • Deep extend: merge objects with nested structure
  • Deferreds: use chain-able utility objects
  • Dimensions: get element width, height and other dimensions
  • Events: for adding simple element event listeners
  • Events advanced: complex event listeners with namespaces and one time events
  • Manipulation: manipulate with elements content and layout
  • Traversing: find elements via selectors and element relations
  • Utils: collection of useful helpers

Installation

SimpleQuery is packaged as CommonJS module available via npm.

npm install simple-query --save