Giter Club home page Giter Club logo

joyquery's Introduction

#joyquery - tiny Javascript library that emulates document.querySelector

##joyquery library

Joyquery is Javascript library that allows to perform CSS selector queries on DOM tree. It does the same job as embedded document.querySelector does, so it can be used as alternative in browsers that miss this function (like Microsoft Internet Explorer prior version 8).

Also joyquery enhances selectors language to provide more features.

Joyquery allows to call Javascript functions from inside selectors to perform complex tests on elements. For example:

var elements = joyquery ( "div > p:contains-word-Hello", null, { contains_word_Hello: function() { return (this.node.textContent || this.node.innerText || '').indexOf('Hello') != -1; } } ).get();

Joyquery supports axises like in XPATH.

var elements = joyquery("figure preceding-sibling::div").get();

Joyquery supports all the standard selectors. However some of them are implemented in extensions, not in the library. See Features.

Joyquery is small library: the library file in minified format is 10KiB (gzipped 4.3KiB). It is also relatively fast: on Firefox near same speed as jQuery for selectors that document.querySelector can't handle, and as twice faster on Chrome.

Joyquery runs on all respectable browsers, plus MSIE 6 or higher. When browser has embedded document.querySelector, and it is able to handle given selector, the built-in function is utilized.

Joyquery is iterable.

for (var elem, it=joyquery('div > a'); elem=it();) { console.log(elem); }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.