var Zepto = (function() {
  var slice=[].slice, d=document,
    CN="className", AEL="addEventListener", PN="parentNode", QSA="querySelectorAll", IO="indexOf",
    T="target", IH="innerHTML", SA="setAttribute",
    ADJ_OPS={append: 'beforeEnd', prepend: 'afterBegin', before: 'beforeBegin', after: 'afterEnd'},
    touch={}, touchTimeout,
    e, k;

  function $$(el, selector){ return slice.call(el[QSA](selector)) }
  function classRE(name){ return new RegExp("(^|\\s)"+name+"(\\s|$)") }
  function dispatch(event, target) {
    target.dispatchEvent(e = d.createEvent('Events'), e.initEvent(event, true, false));
  }

  function $(_, context){
    if(context !== void 0) return $(context).find(_);
    function fn(_){ return fn.dom.forEach(_), fn }
    fn.dom = ((typeof _ == 'function' && 'dom' in _) ? 
      _.dom : (_ instanceof Array ? _ : 
        (_ instanceof Element ? [_] : 
          $$(d, fn.selector = _)))).filter(function(el){
            return el !== void 0 && el !== null;
          });
    for(k in $.fn) fn[k] = $.fn[k];
    return fn;
  }

  $.fn = {
    get: function(idx){ return idx === void 0 ? this.dom : this.dom[idx] },
    remove: function(){
      return this(function(el){ el[PN].removeChild(el) });
    },
    each: function(callback){ return this(callback) },
    find: function(selector){
      return $(this.dom.map(function(el){ return $$(el, selector) }).reduce(function(a,b){ return a.concat(b) }, []));
    },
    closest: function(selector){
      var el = this.dom[0][PN], nodes = $$(d, selector);
      while(el && nodes[IO](el)<0) el = el[PN];
      return $(el && !(el===d) ? el : []);
    },
    pluck: function(property){ return this.dom.map(function(el){ return el[property] }) },
    show: function(){ return this.css('display:block') },
    hide: function(){ return this.css('display:none') },
    prev: function(){ return $(this.pluck('previousElementSibling')) },
    next: function(){ return $(this.pluck('nextElementSibling')) },
    html: function(html){
      return html === void 0 ? (this.dom.length>0 ? this.dom[0][IH] : null) : this(function(el){ el[IH] = html });
    },
    attr: function(name,value){
      return (typeof name == 'string' && value === void 0) ? (this.dom.length>0 ? this.dom[0].getAttribute(name) || undefined : null) :
        this(function(el){
          if (typeof name == 'object') for(k in name) el[SA](k, name[k])
          else el[SA](name,value);
        });
    },
    offset: function(){
      var obj = this.dom[0].getBoundingClientRect();
      return { left: obj.left+d.body.scrollLeft, top: obj.top+d.body.scrollTop, width: obj.width, height: obj.height };
    },
    css: function(style){
      return this(function(el){ el.style.cssText += ';'+style });
    },
    index: function(el){
      return this.dom[IO]($(el).get(0));
    },
    anim: function(transform, opacity, dur){
      return this.css('-webkit-transition:all '+(dur||0.5)+'s;'+
        '-webkit-transform:'+transform+';opacity:'+(opacity===0?0:opacity||1));
    },
    bind: function(event, callback){
      return this(function(el){
        event.split(/\s/).forEach(function(event){ el[AEL](event, callback, false); });
      });
    },
    delegate: function(selector, event, callback){
      return this(function(el){
        el[AEL](event, function(event){
          var target = event[T], nodes = $$(el, selector);
          while(target && nodes[IO](target)<0) target = target[PN];
          if(target && !(target===el) && !(target===d)) callback.call(target, event);
        }, false);
      });
    },
    addClass: function(name){
      return this(function(el){
        !classRE(name).test(el[CN]) && (el[CN] += (el[CN] ? ' ' : '') + name);
      });
    },
    removeClass: function(name){
      return this(function(el){
        el[CN] = el[CN].replace(classRE(name), ' ').replace(/^\s+|\s+$/g, '');
      });
    }
  };
  
  ['width','height'].forEach(function(m){ $.fn[m] = function(){ return this.offset()[m] }});

  for(k in ADJ_OPS)
    $.fn[k] = (function(op){
      return function(html){ return this(function(el){
        el['insertAdjacent' + (html instanceof Element ? 'Element' : 'HTML')](op,html)
      })};
    })(ADJ_OPS[k]);

  ['swipe', 'doubleTap', 'tap'].forEach(function(m){
    $.fn[m] = function(callback){ return this.bind(m, callback) }
  });

  d.ontouchstart = function(e) {
    var now = Date.now(), delta = now-(touch.last || now);
    touch[T] = e.touches[0][T];
    touchTimeout && clearTimeout(touchTimeout);
    touch.x1 = e.touches[0].pageX;
    if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
    touch.last = now;
  }

  d.ontouchmove = function(e) { touch.x2 = e.touches[0].pageX }

  d.ontouchend = function(e) {
    if (touch.isDoubleTap) {
      dispatch('doubleTap', touch[T]);
      touch = {};
    } else if (touch.x2 > 0) {
      Math.abs(touch.x1-touch.x2)>30 && dispatch('swipe', touch[T]);
      touch.x1 = touch.x2 = touch.last = 0;
    } else if ('last' in touch) {
      touchTimeout = setTimeout(function(){
        touchTimeout = null;
        dispatch('tap', touch[T]);
        touch = {};
      }, 250);
    }
  }

  function ajax(method, url, success){
    var r = new XMLHttpRequest();
    r.onreadystatechange = function(){
      if(r.readyState==4 && (r.status==200 || r.status==0))
        success(r.responseText);
    };
    r.open(method,url,true);
    r.setRequestHeader('X-Requested-With','XMLHttpRequest');
    r.send(null);
  }

  $.get = function(url, success){ ajax('GET', url, success); };
  $.post = function(url, success){ ajax('POST', url, success); };
  $.getJSON = function(url, success){
    $.get(url, function(json){ success(JSON.parse(json)) });
  };

  return $;
})();

'$' in window||(window.$=Zepto);
@@ -117,32 +117,8 @@
 de%22,
- QSA=%22querySelectorAll%22,
  IO=
@@ -371,13 +371,25 @@
 l(el
-%5BQSA%5D
+.querySelectorAll
 (sel

remove old optimization for querySelectorAll