Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Replace the current body of the test with a new element. | 6 * Replace the current primary element of the test with a new element. Useful |
|
tsergeant
2017/01/03 23:31:17
As above, undo all changes to this file.
jiaxi
2017/01/04 02:50:16
Done.
| |
| 7 * as an alternative to PolymerTest.clearBody() which preserves styling. | |
| 7 * @param {Element} element | 8 * @param {Element} element |
| 8 */ | 9 */ |
| 9 function replaceBody(element) { | 10 function replaceBody(element) { |
| 10 PolymerTest.clearBody(); | 11 var body = document.body; |
| 11 document.body.appendChild(element); | 12 while (body.children.length > 0) |
| 13 body.removeChild(body.children[0]); | |
| 14 body.appendChild(element); | |
| 12 } | 15 } |
| OLD | NEW |