This project is archived and is in readonly mode.

#139 ✓invalid
riyuk

IE + elem.getParents() = failed

Reported by riyuk | June 18th, 2008 @ 03:11 PM | in 2.0 (closed)

Hi.

I got this code:

$('nav').addEvent('mouseout', function(e) {
	var target = e.relatedTarget;
	if ( target.getParents('div#nav').length > 0 || target == this ) {
		// do something
	} else {
		// do something special like
		that.hideNavAll();
	}
});

Works fine with FF. Failed with IE6/IE7. ( Call to undefined function/method )

Is this my fault or a mootools bug?!

Comments and changes to this ticket

  • Jan Kassens

    Jan Kassens June 18th, 2008 @ 03:57 PM

    • State changed from “new” to “invalid”

    event.relatedTarget is not extended (because of performance reasons)

    use $(event.relatedTarget) instead

  • riyuk

    riyuk June 18th, 2008 @ 03:58 PM

    This is the Errormsg in IE...

    • object does not support property or method
    Native.implement([Element, Window, Document], {
    
    	addEvent: function(type, fn){
    		var events = this.retrieve('events', {});
    		events[type] = events[type] || {'keys': [], 'values': []};
    		if (events[type].keys.contains(fn)) return this;
    		events[type].keys.push(fn);
    		var realType = type, custom = Element.Events.get(type), condition = fn, self = this;
    		if (custom){
    			if (custom.onAdd) custom.onAdd.call(this, fn);
    			if (custom.condition){
    				condition = function(event){
    					if (custom.condition.call(this, event)) return fn.call(this, event);
    					return false;
    				};
    			}
    			realType = custom.base || realType;
    		}
    		var defn = function(){
    			return fn.call(self);
    		};
    		var nativeEvent = Element.NativeEvents[realType] || 0;
    		if (nativeEvent){
    			if (nativeEvent == 2){
    				defn = function(event){
    					event = new Event(event, self.getWindow());
    					if (condition.call(self, event) === false) event.stop(); // this is the error-line
    				};
    			}
    			this.addListener(realType, defn);
    		}
    		events[type].values.push(defn);
    		return this;
    	},
    

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Pages