Skip to content

Commit 806c322

Browse files
committed
Merge pull request BonsaiDen#229 from kiding/don-spec-of-timeouts
Changing the note saying setTimeout is part of the DOM standard.
2 parents 143bda7 + 0712172 commit 806c322

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

doc/en/other/timeouts.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
Since JavaScript is asynchronous, it is possible to schedule the execution of a
44
function using the `setTimeout` and `setInterval` functions.
55

6-
> **Note:** Timeouts are **not** part of the ECMAScript Standard. They are
7-
> implemented as part of the [DOM][1].
6+
> **Note:** Timeouts are **not** part of the ECMAScript standard. They were
7+
> implemented in [BOM, or DOM Level 0][1], which are never defined nor
8+
> documented formally. No recommended specification has been published so far,
9+
> however, they are currently being standardized by [HTML5][2]. Due to this
10+
> nature, the implementation may vary from browsers and engines.
811
912
function foo() {}
1013
var id = setTimeout(foo, 1000); // returns a Number > 0
@@ -115,8 +118,7 @@ specifically.
115118
`setTimeout` and `setInterval` can also take a string as their first parameter.
116119
This feature should **never** be used because it internally makes use of `eval`.
117120

118-
> **Note:** Since the timeout functions are **not** specified by the ECMAScript
119-
> standard, the exact workings when a string is passed to them might differ in
121+
> **Note:** The exact workings when a string is passed to them might differ in
120122
> various JavaScript implementations. For example, Microsoft's JScript uses
121123
> the `Function` constructor in place of `eval`.
122124
@@ -149,9 +151,11 @@ function that will get called by either of the timeout functions.
149151
foo(a, b, c);
150152
}, 1000)
151153

152-
> **Note:** While it is also possible to use the syntax
153-
> `setTimeout(foo, 1000, a, b, c)`, it is not recommended, as its use may lead
154-
> to subtle errors when used with [methods](#function.this).
154+
> **Note:** While it is also possible to use `setTimeout(foo, 1000, a, b, c)`
155+
> syntax, it is not recommended, as its use may lead
156+
> to subtle errors when used with [methods](#function.this).
157+
> Furthermore, the syntax might not work in some JavaScript implementations.
158+
> For example, Microsoft's Internet Explorer [does **not** pass the arguments directly to the callback](3).
155159
156160
### In Conclusion
157161

@@ -163,5 +167,6 @@ be passed that then takes care of the actual call.
163167
Furthermore, the use of `setInterval` should be avoided because its scheduler is not
164168
blocked by executing JavaScript.
165169

166-
[1]: http://en.wikipedia.org/wiki/Document_Object_Model "Document Object Model"
167-
170+
[1]: http://www.nczonline.net/blog/2009/09/29/web-definitions-dom-ajax-and-more/ "Web definitions: DOM, Ajax, and more"
171+
[2]: http://www.w3.org/TR/2014/WD-html5-20140617/webappapis.html#timers "6 Web application APIs - HTML5"
172+
[3]: http://msdn.microsoft.com/en-us/library/ie/ms536753(v=vs.85).aspx "setTimeout method (Internet Explorer)"

0 commit comments

Comments
 (0)