Skip to content

Commit

Permalink
Fixes #1 - IE7 crashed when cloning an element multiple times. Also f…
Browse files Browse the repository at this point in the history
…ix the label for and input id attributes in the legacy uploader

More info about that crash in IE7: https://mootools.lighthouseapp.com/projects/2706/tickets/1196-cloning-element-twice-crashes-ie7#ticket-1196-6
  • Loading branch information
Arian committed Jun 6, 2011
1 parent dd9ac71 commit ba71aa1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/Form.Upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,23 @@ Form.Upload = new Class({
legacyUpload: function(input){

var row = input.getParent('.formRow');
rowClone = row.clone(),
rowClone = row.clone(true, true),
add = function(event){
event.preventDefault();
var newRow = rowClone.clone();

newRow.getElement('input').grab(new Element('a.delInputRow', {
var newRow = rowClone.clone(true, true),
inputID = String.uniqueID(),
label = newRow.getElement('label');

newRow.getElement('input').set('id', inputID).grab(new Element('a.delInputRow', {
text: 'x',
events: {click: function(event){
event.preventDefault();
newRow.destroy();
}}
}), 'after');

if (label) label.set('for', inputID);
newRow.inject(row, 'after');
};

Expand Down

0 comments on commit ba71aa1

Please sign in to comment.