blob: f3fb3630b18e799e2ce9a307be68f2d728de6d8f [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.
* @assertion
* @description Test that iterators are invalidated even if the original context is detached.
import "dart:html";
import "xpath-test-pre.dart";
void main() {
XPathEvaluator evaluator=new XPathEvaluator();
var doc = document.implementation.createDocument(null, "doc", null);
var root = doc.createElement("div");
var result = evaluator.evaluate(".//*", root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
shouldBe(result.invalidIteratorState, false);
shouldBe(result.iterateNext().tagName, 'span');
doc.documentElement.setAttribute("foo", "bar");
shouldBe(result.invalidIteratorState, true);