This section is non-normative.
There are certain features that are not handled by this specification because a client side markup language is not the right level for them, or because the features exist in other languages that can be integrated into this one. This section covers some of the more common requests.
If you wish to create localised
localized versions of an HTML
application, the best solution is to preprocess the files on the
server, and then use HTTP content negotation negotiation
to serve the appropriate language.
Embedding vector graphics into XHTML documents is the domain of SVG.
Embedding 3D imagery into XHTML documents is the domain of X3D, or technologies based on X3D that are namespace-aware.
This section is expected to be moved to the Window Object specification in due course.
interface {[NoInterfaceObject] interface WindowTimers { // timers long setTimeout(in TimeoutHandler handler, in long timeout); long setTimeout(in TimeoutHandler handler, in long timeout, arguments...); long setTimeout(in DOMString code, in long timeout); long setTimeout(in DOMString code, in long timeout, in DOMString language); void clearTimeout(in long handle); long setInterval(in TimeoutHandler handler, in long timeout); long setInterval(in TimeoutHandler handler, in long timeout, arguments...); long setInterval(in DOMString code, in long timeout); long setInterval(in DOMString code, in long timeout, in DOMString language); void clearInterval(in long handle); }; interface TimeoutHandler {void handleEvent();void handleEvent([Variadic] in any args); };
The WindowTimers
interface must be obtainable from any Window
object using binding-specific casting
methods.
Actually even better would be to just mix it straight into Window somehow.
The setTimeout
and
setInterval
methods
allow authors to schedule timer-based events.
The setTimeout(
handler , timeout [,
arguments... ])
method takes a
reference to a TimeoutHandler
object and a length of
time in milliseconds. It must return a handle to the timeout
created, and then asynchronously wait timeout
milliseconds and then invoke handleEvent()
on the
handler object. If any arguments... were provided, they must be passed to the
handler as arguments to the
handleEvent()
function.
In the ECMAScript DOM binding, the
ECMAScript native Function type must implement the TimeoutHandler
interface such that invoking the handleEvent() method of that
interface on the object from another language binding invokes the
function itself, with the arguments passed to handleEvent() as the
arguments passed to the function. In the ECMAScript DOM binding
itself, however, the handleEvent() method of the interface is not
directly accessible on Function objects. Such functions must be
called in the scope of the browsing context in which they were
created. Alternatively, setTimeout( code , timeout [, language ])
may be used. This variant takes a string instead of a
TimeoutHandler
object.
That string must be parsed using the specified language (defaulting to ECMAScript if the third argument
is omitted) and executed in the scope of the browsing context associated with the
Window
object on which the
setTimeout()
method was invoked.
Need to define language values.
The setInterval(...)
variants must work in the same way as the setTimeout
variants except that
if timeout is a value
greater than zero, the handler or
code
must be invoked again every
timeout milliseconds, not just the once.
The clearTimeout()
and
clearInterval()
methods
take one integer (the value returned by setTimeout
and setInterval
respectively) and must
cancel the specified timeout. When called with a value that does
not correspond to an active timeout or interval, the methods must
return without doing anything.
Timeouts must never fire while another script is executing. (Thus the HTML scripting model is strictly single-threaded and not reentrant.)