Skip to content

Commit

Permalink
fix bug mootools#2310
Browse files Browse the repository at this point in the history
IE7 clone node
(http://msdn.microsoft.com/en-us/library/ie/ms536365(v=vs.85).aspx)
have problem when cloning element with id attribute stetted.
  • Loading branch information
Cristian Carlesso authored and Cristian Carlesso committed Jul 30, 2012
1 parent a4da42b commit 5b0f63c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Source/Element/Element.js
Expand Up @@ -818,7 +818,16 @@ Element.implement({

clone: function(contents, keepid){
contents = contents !== false;
var oldID;
/*<ltIE8>*/
if(Browser.ie6 || Browser.ie7 && !keepid){
oldID = this.removeAttribute('id');
}
/*</ltIE8>*/
var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
/*<ltIE8>*/
oldID && Browser.ie6 || Browser.ie7 && this.setAttribute('id', oldID);
/*</ltIE8>*/

if (contents){
ce.append(Array.from(clone.getElementsByTagName('*')));
Expand Down

0 comments on commit 5b0f63c

Please sign in to comment.