From: timmywil Date: Thu, 14 Apr 2011 03:45:58 +0000 (-0400) Subject: IE9's support for SVG elements unfortunately does not extend to clearAttributes.... X-Git-Tag: 1.6b1~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ca5bc202ac37a8e3d5787b24ea3fdc229143802c;p=jquery.git IE9's support for SVG elements unfortunately does not extend to clearAttributes. Checks for its presence before proceeding. --- diff --git a/src/manipulation.js b/src/manipulation.js index 711cb5e88..f519b4d35 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -388,11 +388,15 @@ function cloneFixAttributes( src, dest ) { // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want - dest.clearAttributes(); + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events - dest.mergeAttributes(src); + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } // IE6-8 fail to clone children inside object elements that use // the proprietary classid attribute value (rather than the type diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 2bcc5046e..87fa5625f 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -285,7 +285,7 @@ test("attr(String, Object)", function() { equals( "button", button.attr("type"), "Verify that you can't change the type of a button element" ); // Setting attributes on svg elements (bug #3116) - var $svg = jQuery("" + var $svg = jQuery("" + "" + "").appendTo("body"); equals( $svg.attr("cx", 100).attr("cx"), "100", "Set attribute on svg element" );