[HtmlUnit] [htmlunit:bugs] #1966 setTimeout/setInterval() does not honour [param1, param2, ...] argument
RBRi via HtmlUnit-develop <[email protected]>
| Newsgroups | gmane.comp.java.htmlunit.devel |
|---|---|
| Message-ID | </p/htmlunit/bugs/1966/4ac02e7ade8cf6ca83a2537fd32f44751f85e470.bugs@htmlunit.p.sourceforge.net> |
- **status**: open --> accepted
- **assigned_to**: RBRi
---
** [bugs:#1966] setTimeout/setInterval() does not honour [param1, param2, ...] argument**
**Status:** accepted
**Group:** 2.31
**Created:** Tue Jun 05, 2018 02:47 PM UTC by Atsushi Nakagawa
**Last Updated:** Wed Jun 06, 2018 02:31 AM UTC
**Owner:** RBRi
## Problem in brief
HtmlUnit 2.31's `window.setTimeout()` and `window.setInterval()` do not honour the `[param1, param2, ...]` part of their respective definitions[1][2]:
```
var timeoutID = scope.setTimeout(function[, delay[, param1, param2, ...]]);
var intervalID = scope.setInterval(func, delay[, param1, param2, ...]);
```
[1] https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
[2] https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval
To be precise, it appears to be implementing this *"`language`"* parameter instead[3][4].
[3] https://sourceforge.net/p/htmlunit/code/15299/tree/trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java#l493
[4] https://sourceforge.net/p/htmlunit/code/15299/tree/trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java#l1500
This *`language`* parameter appears to be an outdated parameter from MSIE's DHTML era. Other than that I've found find very little documentation[5][6][7].
[5] [https://msdn.microsoft.com/en-us/ie/ms536749(v=vs.94)](https://msdn.microsoft.com/en-us/ie/ms536749(v=vs.94))
[6] https://msdn.microsoft.com/ja-jp/library/cc428172.aspx
[7] https://blogs.msdn.microsoft.com/irenak/2007/03/20/sysk-310-the-difference-between-setinterval-and-settimeout/
## Code to reproduce
```html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function test() {
setTimeout(function (x, y) {
console.log("setTimeout(x = " + x + ", y = " + y + ")")
}, 1, "abc", 123)
var intervalID = setInterval(function (x, y) {
console.log("setInterval(x = " + x + ", y = " + y + ")")
clearInterval(intervalID)
}, 1, "def", 456)
}
</script>
</head>
<body>
<input type="button" onclick="test()" value="test"/>
</body>
</html>
```
Major browsers, including IE 11, prints:
```
setTimeout(x = abc, y = 123)
setInterval(x = def, y = 456)
```
HtmlUnit 2.31 prints:
```
setTimeout(x = undefined, y = undefined)
setInterval(x = undefined, y = undefined)
```
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop