blob: 049147f97ec4731ce82e78e3d385c38c625fca99 [file] [log] [blame]
* Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
* @description Ensures that replaceChild() throws an exception if mutation
* even handler does something wrong
import "dart:html";
import "../../testcommon.dart";
import "../../../Utils/async_utils.dart";
main() {
<div id="target">
<b></b><b id="oldChild"></b><b></b>
<div id="newChild"></div>
''', treeSanitizer: new NullTreeSanitizer());
var target = document.getElementById('target');
var oldChild = document.getElementById('oldChild');
var newChild = document.getElementById('newChild');
handler(_) {
document.removeEventListener("DOMNodeRemoved", handler, false);
document.addEventListener("DOMNodeRemoved", handler, false);
shouldThrow(() => oldChild.replaceWith(newChild),
(e) => e is DomException && == DomException.HIERARCHY_REQUEST);