Just spent more time than I should discovering a (possible) bug in
prototype's new Element and could not find it in a web search so
thought I'd log it here.

I have an object that stores the type of a pop-up (simplified):

  this.attributes = {name: 'value', type: 'text'};

then uses the object to create a new element of the correct type:

  new Element('input', this.attributes);

in IE7 (not Firefox) the name parameter is deleted so next time I call

   new Element('input', this.attributes);

the input element does not have a name property.


I fixed it with a rather big kludge in the call to make a copy of the
attributes:

    new Element('input', $H(op.attributes).clone().toObject());

The problem seems to be in prototype.js global.Element where the code says

if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) {
      tagName = '<' + tagName + ' name="' + attributes.name + '">';
      delete attributes.name;
    ...


Hope this helps someone (or maybe someone else can suggest a better fix!).

cheers
Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to