Bug 105914 - SVG animation does not run if added after the document is loaded
Summary: SVG animation does not run if added after the document is loaded
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://bender.igel.co.jp/dev/run.html...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-01-02 03:16 PST by pom
Modified: 2013-01-24 04:48 PST (History)
4 users (show)

See Also:


Attachments
Build an SVG fragment and insert it in an HTML document; the animation does not start (2.51 KB, text/html)
2013-01-02 03:16 PST, pom
no flags Details
Build an SVG fragment and insert it in an SVG document; the animation does not start either (2.49 KB, image/svg+xml)
2013-01-02 03:18 PST, pom
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description pom 2013-01-02 03:16:53 PST
Created attachment 181020 [details]
Build an SVG fragment and insert it in an HTML document; the animation does not start

An SVG animation added into a HTML or SVG document after the document is loaded does not run at all in Safari on OS X (tested on 10.7.5 with Safari 6.0.2) and iOS (tested on 6.0.1). The attached example creates a polygon with an animateTransform child to rotate it for 500ms with an implicit begin time of 0. If the content is created before the end of the document is reached (i.e., in a script inside the body of the document) then the content appears and animates as expected. If the content is created later (i.e., delayed with a setTimeout) then the content appears correctly but the animation does not run at all. The expectation is that the animation should start anyway. Both a HTML and SVG version are attached showing the same problem.

Testing on Firefox, Chrome and the latest WebKit nightly show the expected results (i.e., the animation runs in all cases.)

The attached test case is a reduction of a more complex example found at: http://bender.igel.co.jp/dev/run.html?href=demo/logo.xml

In this version, the SVG content is actually loaded from an external resource (using XMLHttpRequest) and inserted in the document. However, in that situation, the results differ between Safari on OS X and on iOS: on OS X the animation does start (as it does on FF, Chrome and WebKit nightly), but not on iOS.
Comment 1 Radar WebKit Bug Importer 2013-01-02 03:17:30 PST
<rdar://problem/12943050>
Comment 2 pom 2013-01-02 03:18:08 PST
Created attachment 181021 [details]
Build an SVG fragment and insert it in an SVG document; the animation does not start either
Comment 3 Tim Horton 2013-01-22 01:23:54 PST
(In reply to comment #0)
> Testing on Firefox, Chrome and the latest WebKit nightly show the expected results (i.e., the animation runs in all cases.)

I'm confused. If it's fixed in a WebKit nightly, why the bug?
Comment 4 Antoine Quint 2013-01-24 04:48:01 PST
(In reply to comment #3)
> (In reply to comment #0)
> > Testing on Firefox, Chrome and the latest WebKit nightly show the expected results (i.e., the animation runs in all cases.)
> 
> I'm confused. If it's fixed in a WebKit nightly, why the bug?

Yeah, I think this is fixed.