mouseenter/mouseleave fire when selecting <option>

71 views
Skip to first unread message

Leo

unread,
Jul 24, 2008, 12:12:31 AM7/24/08
to MooTools Users
I've been searching all over and can't figure this out. I have a
container div with mouseenter and mouseleave events. However, these
events fire when I am choosing an option from a select box. I checked
that the select box is a child of the container.

Here's the code I am using for creating the select element and
options:

monthSel = new Element('select', {'id':'monthSelect'});
for (var m = 0; m < this.options.monthNames.length; m++){
monthSel.options[m] = new Option(this.options.monthNames[m], m);
if (this.month == m) monthSel.options[m].selected = true;
}

(using MooTools 1.2)

Thanks!

Leo

unread,
Jul 24, 2008, 2:11:54 AM7/24/08
to MooTools Users
Found the problem! There's a little bug in 1.2-core. Pretty sure it's
not the only one.

var $check = function(event){
var related = event.relatedTarget;
if (related == undefined) return true;
if (related === false) return false;
return ($type(this) != 'document' && related != this &&
related.prefix != 'xul' && !this.hasChild(related));
};

Third line should be:
if (related == undefined) return false;
Reply all
Reply to author
Forward
0 new messages