Hi, Jonathan-
Jonathan Chetwynd wrote (on 9/5/10 10:33 AM):
> is there a way to reload<group> from source?
>
> the document contains a large group every line of which is altered
> using script, in this case four stopwatches.
>
> obviously one could cycle with script through every object and reset
> to zero**, but is there a way to just reload the group from the
> source code of the document?
I don't know of a way to "reload" the element, per se.
However, if you know in the beginning that you want to treat the <g>
element (and its children) this way, you can make a deep clone of the
<g>, and simply replace the original <g> with the clone in order to
"refresh" it.
Here's some untested rough code:
var originalG = null;
var currentG = null;
function init() {
currentG = document.getElementById("watch-g");
originalG = currentG.cloneNode(true); // 'true' means copy all the
children, too
}
function reload () {
currentG.parentNode.replaceChild( originalG, currentG );
originalG = currentG.cloneNode(true); // save a new fresh copy for later
}
> if not, would this merit taking to the wg?
> if not, why not?
This would not be an issue for the SVG WG, but for the DOM folks in the
WebApps WG. But since this is not a overwhelmingly common use case, and
there is relatively easy (if convoluted) workaround, I doubt that there
would be much will among the browser vendors to add new functionality to
allow you to properly reload portions of the document; if for no other
reason, it would force them to cache 2 copies in memory, doubling the
memory footprint of each document.
Hope that helps.
Regards-
-Doug
------------------------------------
-----
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/