blob: a3b45a81f23562182f29a8b9e5dd4532ed50d9b0 [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 DocumentFragment createFragment(String html,
/// {NodeValidator validator, NodeTreeSanitizer treeSanitizer})
/// Create a DocumentFragment from the HTML fragment and ensure that it
/// follows the sanitization rules specified by the validator or treeSanitizer.
/// The returned tree is guaranteed to only contain nodes and attributes which
/// are allowed by the provided validator.
/// @description Checks that this method call creates text only
/// @issue 43331
import "dart:html";
import "../../../Utils/expect.dart";
main() {
IFrameElement x = new IFrameElement();
var f = x.createFragment('<div foo="foo"><bar id="bar"></bar></div>',
validator: new NodeValidatorBuilder()
//..allowHtml5()
..allowElement('bar', attributes: ["id"])
..allowElement('div', attributes: ["foo"]));
Expect.isTrue(f.firstChild is CharacterData);
var bar = f.querySelector('#bar');
Expect.isNull(bar);
}