lib/air.js
function Air(el, context) {
    if(!(this instanceof Air)) {
      return new Air(el, context);
    }
    if(typeof context === 'string') {
      context = document.querySelector(context);
    }else if(context instanceof Air) {
      context = context.get(0);
    }
    context = context || document;
    // NOTE: do not pass empty string to querySelectorAll
    if(!arguments.length || el === '') {
      this.dom = []; 
    }else{
      this.dom = typeof el === 'string' ? context.querySelectorAll(el) : el;
    }
    if(el instanceof Air) {
      this.dom = el.dom.slice(0);
    }else if(!Array.isArray(el)) {
      if(this.dom instanceof NodeList) {
        this.dom = Array.prototype.slice.call(this.dom);
      }else if(el) { 
        this.dom = ((el instanceof Node) || el === window) ? [el] : [];
      }
    }

    // shortcut to Array.prototype.slice
    this.slice = Array.prototype.slice;
  }
function Air(el, context) {
    if(!(this instanceof Air)) {
      return new Air(el, context);
    }
    if(typeof context === 'string') {
      context = document.querySelector(context);
    }else if(context instanceof Air) {
      context = context.get(0);
    }
    context = context || document;
    // NOTE: do not pass empty string to querySelectorAll
    if(!arguments.length || el === '') {
      this.dom = []; 
    }else{
      this.dom = typeof el === 'string' ? context.querySelectorAll(el) : el;
    }
    if(el instanceof Air) {
      this.dom = el.dom.slice(0);
    }else if(!Array.isArray(el)) {
      if(this.dom instanceof NodeList) {
        this.dom = Array.prototype.slice.call(this.dom);
      }else if(el) { 
        this.dom = ((el instanceof Node) || el === window) ? [el] : [];
      }
    }

    // shortcut to Array.prototype.slice
    this.slice = Array.prototype.slice;
  }
function Air ( el , context ) { if ( ! ( this instanceof Air ) ) { return new Air ( el , context ) ; } if ( typeof context === 'string' ) { context = document . querySelector ( context ) ; } else if ( context instanceof Air ) { context = context . get ( 0 ) ; } context = context || document ; // NOTE: do not pass empty string to querySelectorAll if ( ! arguments . length || el === '' ) { this . dom = [ ] ; } else { this . dom = typeof el === 'string' ? context . querySelectorAll ( el ) : el ; } if ( el instanceof Air ) { this . dom = el . dom . slice ( 0 ) ; } else if ( ! Array . isArray ( el ) ) { if ( this . dom instanceof NodeList ) { this . dom = Array . prototype . slice . call ( this . dom ) ; } else if ( el ) { this . dom = ( ( el instanceof Node ) || el === window ) ? [ el ] : [ ] ; } } // shortcut to Array.prototype.slice this . slice = Array . prototype . slice ; }
Chainable wrapper class.

This is the core of the entire plugin system and typically you extend
functionality by adding methods to the prototype of this function.

However a plugin may also add static methods to the main function,
see the `create` plugin for an example of adding static methods.

This implementation targets modern browsers (IE9+) and requires that
the array methods `isArray`, `forEach` and `filter` are available,
for older browsers you will need to include polyfills.

@param el A selector, DOM element, array of elements or Air instance.
@param context The context element for a selector.
Chainable wrapper class .