Skip to content
Permalink
Browse files

IE9's support for SVG elements unfortunately does not extend to clear…

…Attributes. Checks for its presence before proceeding.
  • Loading branch information...
timmywil
timmywil committed Apr 14, 2011
1 parent 149a040 commit ca5bc202ac37a8e3d5787b24ea3fdc229143802c
Showing with 7 additions and 3 deletions.
  1. +6 −2 src/manipulation.js
  2. +1 −1 test/unit/attributes.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();

This comment has been minimized.

Copy link
@dmethvin

dmethvin Apr 14, 2011

Member

Should IE9 be in cloneFixAttributes? It's not using attachEvent except perhaps in special events, and there is already an open ticket for event problems caused by cloning special events. I suspect it got here due to noCloneChecked, unless the support.js rewrite introduced a bug.

This comment has been minimized.

Copy link
@timmywil

timmywil Apr 14, 2011

Member

It was called on element creation. http://bot-t.com/jquery.js#149
cacheable is true there so it returns a cloned fragment. Unfortunately, clearAttributes is not on the SVGElement prototype in IE9 and throws an exception.

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
@@ -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("<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' baseProfile='full' width='3000' height='3000'>"
var $svg = jQuery("<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' baseProfile='full' width='200' height='200'>"
+ "<circle cx='200' cy='200' r='150' />"
+ "</svg>").appendTo("body");
equals( $svg.attr("cx", 100).attr("cx"), "100", "Set attribute on svg element" );

0 comments on commit ca5bc20

Please sign in to comment.
You can’t perform that action at this time.