Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix Element.clone for IE6: Element.id was still present after clone. #2083

Merged
merged 5 commits into from

3 participants

@ibolmo
Owner

No description provided.

@arian
Owner

I believe this might crash IE7

@ibolmo
Owner

Worksforme in IE7.

ibolmo added some commits
@ibolmo ibolmo Fix Element.clone for IE6: Element.id was still present after clone. 9bcf0c4
@ibolmo ibolmo Fixed clone for IE9. If you pass null to removeAttributeNode IE9 thro…
…ws: Error: Invalid pointer
343148b
@ibolmo ibolmo Passing specs, except i'm not 100% on the solution. Commiting for his…
…tory.
b16b356
@ibolmo ibolmo With the updated specs, all green (related to this commit) for IE6-9 and
Chrome latest, Safari latest, Opera, Firefox 3-5.

The fix in Element.js is to overload the setter, getter, and erase to
forcibly update the id attribute (on the object) and with the attribute
node. It's unfortunate, but IE has trouble removing attributes of
cloned nodes.

We should be vigilant of other troublesome attribute nodes that might be
problematic.
49d4859
@ibolmo
Owner

Chrome latest, Safari latest, Opera, Firefox 3-5.

The fix in Element.js is to overload the setter, getter, and erase to
forcibly update the id attribute (on the object) and with the attribute
node. It's unfortunate, but IE has trouble removing attributes of
cloned nodes.

We should be vigilant of other troublesome attribute nodes that might be
problematic.

Please review and merge.

@cpojer
Owner

This is really nice.

@cpojer cpojer merged commit 40e3c4e into from
@arian
Owner

wow, nice!

@arian arian referenced this pull request
Closed

fix bug #2310 #2387

@arian arian referenced this pull request from a commit in arian/mootools-core
@arian arian Fixes #2310 - Using get/erase/set('id') which uses fix #2083, instead…
… of outerHTML hack.
4cdf46d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 24, 2011
  1. @ibolmo
  2. @ibolmo

    Fixed clone for IE9. If you pass null to removeAttributeNode IE9 thro…

    ibolmo authored
    …ws: Error: Invalid pointer
  3. @ibolmo
  4. @ibolmo

    With the updated specs, all green (related to this commit) for IE6-9 and

    ibolmo authored
    Chrome latest, Safari latest, Opera, Firefox 3-5.
    
    The fix in Element.js is to overload the setter, getter, and erase to
    forcibly update the id attribute (on the object) and with the attribute
    node. It's unfortunate, but IE has trouble removing attributes of
    cloned nodes.
    
    We should be vigilant of other troublesome attribute nodes that might be
    problematic.
  5. @ibolmo
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 1 deletion.
  1. +15 −0 Source/Element/Element.js
  2. +1 −1  Specs
View
15 Source/Element/Element.js
@@ -948,4 +948,19 @@ if (testForm.firstChild.value != 's') Element.Properties.value = {
};
/*</ltIE9>*/
+/*<IE>*/
+var el = document.createElement('div');
+if (el.getAttributeNode('id')) Element.Properties.id = {
+ set: function(id){
+ this.id = this.getAttributeNode('id').value = id;
+ },
+ get: function(){
+ return this.id || null;
+ },
+ erase: function(){
+ this.id = this.getAttributeNode('id').value = null;
+ }
+};
+/*</IE>*/
+
})();
2  Specs
@@ -1 +1 @@
-Subproject commit dcf45d49cb986672e8f0e0eafe4122ef4951ac5d
+Subproject commit 9f125b2338854a89e0d22bf8014790bd53dd8994
Something went wrong with that request. Please try again.