- From: Kristof Zelechovski <giecrilj@stegny.2a.pl>
- Date: Sun, 15 Mar 2009 15:22:34 +0100
Here is how to obtain the functionality of a deferred style sheet for a
run-time dialogue box: the semantics of the depends attribute must be
changed so that it causes all script code *except function definitions* to
wait for the style sheet to load (and perhaps cause it to load as well);
whereas all functions defined in such a script would be tagged with the
dependency of the script element and wait for the dependents when *called*.
Thus, the script handling the dialogue box can be static, and the dependents
would be loaded only when one of the functions defined there is invoked.
<style id=dbSheeet > </style >
<script depends="dbSheet" >
/* does not wait for dbSheet */
function displayDialogue(title, args) { } </script >
<button
onClick="displayDialogue("Peekaboo", this)
/* waits for dbSheet and passes a reference to an object */" >
</button >
This would work even if dbSheet is dynamic.
The downside of this solution is that the instruction
window .displayDialogue = function displayDialogue(title, args) {}
would not be equivalent to a plain definition of function displayDialogue.
This difference, however, would manifest itself only on pages that would be
broken anyway.
Chris
Received on Sunday, 15 March 2009 07:22:34 UTC