The side-note in the chapter about setTimeout is not correct. Quote: "Note: Timeouts are not part of the ECMAScript Standard. They are implemented as part of the DOM."
The setTimeout function and the DOM are not related. The setTimeout function is a global function in the browsers. The DOM is rooted in the document object. Therefore, the timer functions are not part of the DOM in any way.
The note should read: "They are implemented in browsers as global functions (properties of the widow object)."
The root of the DOM is not the document object, it is the window object. document is actually a property of the window object. (along with other properties such as location, history, etc.)
I disagree. Do you have a source? If you do, please give it.
The DOM specs (the W3C DOM standards) do not mention the window object. The topmost entity defined by the DOM specs is the Document interface. In the browsers, this interface is implemented by the document object. Therefore, the document object is the root of the DOM in the browser.
The browsers implement lots of other global properties (besides the document object). For instance: location, history, navigator, applicationCache, localStorage and sessionStorage, console, the timer functions, alert, postMessage, getSelection, etc. All those properties are NOT considered as part of the DOM.
I accidentally closed this issue (I'm new to Github). Please re-open.
After reading the specs once more, I concur. I always assumed the window object was at the top of the DOM hierarchy (think event bubbling), but it appears that it is just part of an optional interface.
For what its worth, MDN claims window.setTImeout is part of DOM Level 0. I've also heard of it classified under the Browser Object Model, whatever that is (this SO question does nothing to clear it up).
I've added my answer to that SO question.
If you fancy updating the wording to be more specific that'd be great! Otherwise I'll close in a few days.
Even to this day, I think the sentence is misleading. "They are being standardized in HTML5" maybe?
Since it's not in ECMAScript standard, node.js has its own implementation; it doesn't return a number ID from setTimeout/setInterval but rather an object. HTML5 states setTimeout should accept parameters that can be delivered to the given function, but IE currently implements it differently, although this difference is not mentioned in the article.
Pull requests definitely accepted - with some context. Perhaps as a footnote?
I'm not sure how to write a footnote since I can't find any example in the article. If we were to write also the context in the Note: section we're talking about, it might be a bit long. Will that be okay? 5 lines tops, I guess.
So I've made a pull request referencing this issue. Any comment is appreciated. Thanks!
great - merged it! thanks