Skip to content

Commit

Permalink
basic Internet Explorer compatibility
Browse files Browse the repository at this point in the history
IE10 still doesn't pass the suite but is almost there.
  • Loading branch information
mislav committed Sep 15, 2011
1 parent da3992e commit 92fee13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/zepto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion vendor/evidence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 92fee13

Please sign in to comment.