Skip to content

Commit

Permalink
IE uses fireEvent and createEventObject
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil Maj committed Nov 1, 2011
1 parent e0b7490 commit 229e195
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/ie/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ xui.extend({

fire: function (type, data) {
return this.each(function (el) {
if (el == document && !el.dispatchEvent)
if (el == document && !el.fireEvent)
el = document.documentElement;

var event = document.createEvent('HTMLEvents');
event.initEvent(type, true, true);
var event = document.createEventObject();
event.data = data || {};
event.eventName = type;

el.dispatchEvent(event);
el.fireEvent("on" + type, event);
});
}

Expand All @@ -101,15 +100,6 @@ xui.extend({
xui.fn[event] = function(action) { return function (fn) { return fn ? this.on(action, fn) : this.fire(action); }; }(event);
});

// this doesn't belong on the prototype, it belongs as a property on the xui object
xui.touch = (function () {
try{
return !!(document.createEvent("TouchEvent").initTouchEvent)
} catch(e) {
return false;
};
})();

xui.ready = function(handler) {
domReady(handler);
}
Expand Down

0 comments on commit 229e195

Please sign in to comment.