This project is archived and is in readonly mode.

#40 ✓duplicate
Thomas Aylott

Form w/ an input name or id of "position" breaks in IE

Reported by Thomas Aylott | May 28th, 2008 @ 10:05 AM | in 2.0 (closed)

Originally posted on Trac by SecretAgentRege

Original Trac Ticket


In IE7 & IE6, If you have a form with any type of input that has a name or id value of "position," the form breaks when you try to pass it through mootools.

This fails in IE:


I came across this on an employer's form that asked for the position that the user held within their company and had the select box's name as "position". Took me a while to figure out it was the input's name that was the problem (and not the form itself).

Trac Attachments

Trac Comments

Changed 2 months ago by kasi

In general it breaks when the name exists in Element.Prototype. So this also fails 

This one would work: 

$.element = function(el, notrash){
	if (!notrash && !el.$family && !(/^object|embed$/i).test(el.tagName)){
		var proto = Element.Prototype;
        if ((/^form$/i).test(el.tagName)){
            for (var p in proto) 
                if (!el.elements[p]) el[p] = proto[p];
        else {
		    for (var p in proto) el[p] = proto[p];
	return el;

But that means, when you have an element named addEvent for example, you can not add events to a form any more! I think there is no workaround for this, except having a big warning in the docs. 



Comments and changes to this ticket

Create your profile

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

Shared Ticket Bins


Referenced by