Adding "date" detection to `detectType`

Addresses [Issue #800](http://code.google.com/p/phantomjs/issues/detail?id=800)
1.8
Ivan De Marino 2012-10-18 22:51:25 +01:00
parent 4c5e96d17f
commit 7c7d1f961c
2 changed files with 3 additions and 0 deletions

View File

@ -303,6 +303,8 @@ window.detectType = function (value) {
s = 'array';
} else if (value instanceof RegExp) {
s = 'regexp';
} else if (value instanceof Date) {
s = 'date';
}
} else {
s = 'null';

View File

@ -282,6 +282,7 @@ function decorateNewPage(opts, page) {
switch (argType) {
case "object": //< for type "object"
case "array": //< for type "array"
case "date": //< for type "date"
str += "JSON.parse(" + JSON.stringify(JSON.stringify(arg)) + "),"
break;
case "string": //< for type "string"