W3C home > Mailing lists > Public > public-html@w3.org > April 2007

Re: innerHTML and setTimeout

From: liorean <liorean@gmail.com>
Date: Tue, 10 Apr 2007 12:02:34 +0200
Message-ID: <cee13aa30704100302o2d75047dqa06df614aacbcd91@mail.gmail.com>
To: "HTML WG" <public-html@w3.org>

On 09/04/07, Dao Gottwald <dao@design-noir.de> wrote:
> > In my opinion, timer events belong in the DOM, as part of a
> > documentation of the de facto standard Window object (which should be
> > part of the DOM) or possibly as part of the DOM (3?) Events
> > specification.
>
> Err, no. Timeouts != events.

That depends on perspective. In the JavaScript execution model the
browser is apparently singly threaded. When events and timers are
taken into consideration, they both end up in an execution queue, each
queued block of code running to completion in order. (Ordered, except
for possible disruption of the queue from applets, plugins or halting
functions such as alert which can cause events to be queued in between
calling the halting function and the completion of the block of code
that called the halting function.)

In that light, timers can be seen as events, sharing the same event
queue and all. setTimeout and setInterval could conceptually be seen
as interfaces scheduling one or several timer event and setting a
listener on that event. They do not partake in the event cascade
through the document though, because they are not related to the
document, only the window object.
-- 
David "liorean" Andersson
Received on Tuesday, 10 April 2007 10:02:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:42 UTC