Permalink
Browse files

Changed while to a do loop - removes duplication

  • Loading branch information...
1 parent 0b5d857 commit 7edccff5cbaefbd0ac74592021b78fbe50404e05 @remy committed Jun 18, 2010
Showing with 3 additions and 4 deletions.
  1. +3 −4 events.js
View
@@ -79,16 +79,15 @@ var ev = (function (window, document, undefined) {
try {
el['on' + type].call(el, data);
} catch (e) {
- var id = el[expando];
- handlers[type] && handlers[type][id] && handlers[type][id].call(el, { type: type, data : data || {} });
- while (el = el.parentNode) {
+ var id;
+ do {
id = el[expando];
if (!el || el.nodeType === 3 || el.nodeType === 8) {
return; // we're done - this shouldn't happen
} else {
handlers[type][id] && handlers[type][id].call(el, { type: type, data : data || {} });
}
- }
+ } while (el = el.parentNode)
}
});
};

0 comments on commit 7edccff

Please sign in to comment.