Skip to content

Commit

Permalink
ensure super works on prototype challenged platforms (IE). This ensur…
Browse files Browse the repository at this point in the history
…es we find Element.bind via super.
  • Loading branch information
sorvell committed Sep 17, 2013
1 parent 6180e9a commit 5c5df3d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/super.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@
return fn.apply(this, arrayOfArgs || []);
}
};

function nextSuper(proto, name, caller) {
// look for an inherited prototype that implements name
while (proto &&
(!proto.hasOwnProperty(name) || proto[name] === caller)) {
while (proto) {
if ((proto[name] !== caller) && proto[name]) {
return proto;
}
proto = getPrototypeOf(proto);
}
return proto;
};


function memoizeSuper(method, name, proto) {
// find and cache next prototype containing `name`
// we need the prototype so we can do another lookup
Expand Down

0 comments on commit 5c5df3d

Please sign in to comment.