Chromium Code Reviews| Index: LayoutTests/resources/js-test.js |
| diff --git a/LayoutTests/resources/js-test.js b/LayoutTests/resources/js-test.js |
| index 10abf0bc336b48f85c4658e6af7efd4818a7443b..392762a980693d8de147483d8db9453c3610ae56 100644 |
| --- a/LayoutTests/resources/js-test.js |
| +++ b/LayoutTests/resources/js-test.js |
| @@ -199,6 +199,23 @@ function stringify(v) |
| else return "" + v; |
| } |
| +// Stringifies a DOM object. This function stringifies not only own properties |
| +// but also DOM attributes which are on a prototype chain. Note that |
| +// JSON.stringify only stringifies own properties. |
| +function stringifyDOMObject(object) |
| +{ |
| + function deepCopy(src) { |
| + if (typeof src != "object") |
| + return src; |
| + var dst = src instanceof Array ? [] : {}; |
|
jsbell
2015/01/21 18:09:39
Nit: Use Array.isArray()
(instanceof doesn't work
Yuki
2015/01/22 06:53:29
Done.
|
| + for (var property in src) { |
| + dst[property] = deepCopy(src[property]); |
| + } |
| + return dst; |
| + } |
| + return JSON.stringify(deepCopy(object)); |
| +} |
| + |
| function evalAndLog(_a, _quiet) |
| { |
| if (typeof _a != "string") |