[dev] [cvs] commit: kronolith/js embed.js kronolith/js/src embed.js kronolith/themes embed.css
Michael M Slusarz
slusarz at horde.org
Thu Aug 21 16:12:39 UTC 2008
Quoting Michael Rubinsky <mrubinsk at horde.org>:
>>> 2) Currently, this code needs to be run after *all* the widgets
>>> are processed and loaded in the DOM since the <a> elements don't
>>> exist until after window load. The way the code is currently,
>>> we can't guarantee the order that widgets from all Horde
>>> applications are loaded since they can appear anywhere on the
>>> embedded page. That being said, it could (and probably should)
>>> be refactored to only process our widgets' elements instead of
>>> the whole page anyway, so I'll take a look at making this
>>> possible...probably by not firing it onload, but instead
>>> processing the <a> elements as they are created.
>>
>> But isn't onload only fired if all <script> elements have been
>> loaded and executed? Or are the widgets created onload too?
>
> Yes, they are inserted into the DOM onload.
This situation can be handled entirely via javascript via the
following pseudocode:
document.observe('load', allWidgetsLoaded());
function allWidgetsLoaded() {
if ([check for existence of all needed elements]) {
[code done after all widgest loaded]
} else {
allWidgetsLoaded.defer();
}
}
michael
--
___________________________________
Michael Slusarz [slusarz at horde.org]
More information about the dev
mailing list