From 92fee137d5ad790350a0fa3175dc79135ffced37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohnic=CC=81?= Date: Wed, 14 Sep 2011 17:14:43 +0200 Subject: [PATCH] basic Internet Explorer compatibility IE10 still doesn't pass the suite but is almost there. --- src/zepto.js | 10 ++++++++-- vendor/evidence.js | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/zepto.js b/src/zepto.js index 28a781538..08138723f 100644 --- a/src/zepto.js +++ b/src/zepto.js @@ -4,6 +4,7 @@ var Zepto = (function() { var undefined, key, $$, classList, emptyArray = [], slice = emptyArray.slice, + supportsProto = '__proto__' in emptyArray, document = window.document, elementDisplay = {}, classCache = {}, getComputedStyle = document.defaultView.getComputedStyle, @@ -70,16 +71,21 @@ var Zepto = (function() { function Z(dom, selector){ dom = dom || emptyArray; - dom.__proto__ = Z.prototype; + if (supportsProto) dom.__proto__ = Z.prototype; + else $.extend(dom, Z.prototype); dom.selector = selector || ''; return dom; } + var isZ = supportsProto ? + function(obj) { return obj instanceof Z } : + function(obj) { return isA(obj) && 'eq' in obj }; + function $(selector, context){ if (!selector) return Z(); if (context !== undefined) return $(context).find(selector); else if (isF(selector)) return $(document).ready(selector); - else if (selector instanceof Z) return selector; + else if (isZ(selector)) return selector; else { var dom; if (isA(selector)) dom = compact(selector); diff --git a/vendor/evidence.js b/vendor/evidence.js index af0fdea7d..0a7f6d060 100644 --- a/vendor/evidence.js +++ b/vendor/evidence.js @@ -786,7 +786,11 @@ Logger.NOTSET = 0; if (params) { params = params.slice(0); params.unshift(template); - c[method].apply(c, params); + try { + c[method].apply(c, params); + } catch (e) { + c[method](params[0]) + } } else { c[method](template); }