fakesmile - dynamically creating animate element

"pablo.platt" <[email protected]>
Newsgroups gmane.text.xml.svg.devel
Message-ID <[email protected]>
Hi,

I'm using FakeSmile to enable animations in IE9.
I'm able to use the animate element when it is initially part of the svg document but when I'm adding an animate element dynamically I'm getting an error on IE9:
Object doesn't support property or method 'beginElement'

Static works:
http://jsfiddle.net/6gZWn/1/

Dynamic doesn't work:
http://jsfiddle.net/DgMDV/13/

What am I doing wrong?

Thanks


Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
</head>
<body>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /><svg
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   version="1.0"
   viewBox="0 0 120 40"
    xml:space="preserve">
<script type="text/ecmascript" xlink:href="http://leunen.me/fakesmile/smil.user.js" />
   <rect  x="10" y="10" width="10" height="10" fill="#c66" />
</svg>

<sctipt type="text/javascript">
var svg   = document.getElementsByTagName('svg')[0];
var rect = document.getElementsByTagName('rect')[0];

var animation = document.createElementNS(
    "http://www.w3.org/2000/svg", "animate");
animation.setAttributeNS(null, 'attributeName', 'x');
animation.setAttributeNS(null, 'dur', 0.5);
animation.setAttributeNS(null, 'begin', 'indefinite');
animation.setAttributeNS(null, 'fill', 'freeze');
animation.setAttributeNS(null, 'to', 100);
rect.appendChild(animation);
animation.beginElement();
</script>
</body>
</html>



------------------------------------

-----
To unsubscribe send a message to: [email protected]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.