beCodeMyFriend / Cuore.js

Other
34 stars 13 forks source link

Button - preventDefault in IE8 #19

Closed hell03610 closed 12 years ago

hell03610 commented 12 years ago

in Cuore.Dom.Event.js

listener is not added as attachEvent is not function in IE8, but as object

var _isIEListener = function(){

    return (typeof document.attachEvent === 'function' || typeof document.attachEvent === 'object');

};

PreventDefault and StopPropagation are made by properties instead of functions:

var stopDefault = function(el, type) {

    add(el, type, function(event) {

        if (!event) return;

        (event.preventDefault)? event.preventDefault() : event.returnValue = false;

        (event.stopPropagation)? event.stopPropagation() : event.cancelBubble = true;

    });

};