blob: a43c6fe75501d2637136aaefc138a236db98c3cb [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 Element insertAdjacentElement(String where, Element element)
/// Inserts element into the DOM at the specified location.
/// @description Checks insert for possible values of [where]
import "dart:html";
import "../../../Utils/expect.dart";
main() {
var div, x;
IFrameElement? iframe;
void init() {
div = new Element.html('<div><iframe>Content</iframe></div>') as DivElement;
iframe = div.firstChild;
x = new PreElement();
iframe?.insertAdjacentElement('beforeBegin', x);
Expect.equals('<div><pre></pre><iframe>Content</iframe></div>', div.outerHtml,
iframe?.insertAdjacentElement('afterBegin', x);
Expect.equals('<div><iframe><pre></pre>Content</iframe></div>', div.outerHtml,
iframe?.insertAdjacentElement('beforeEnd', x);
Expect.equals('<div><iframe>Content<pre></pre></iframe></div>', div.outerHtml,
iframe?.insertAdjacentElement('afterEnd', x);
Expect.equals('<div><iframe>Content</iframe><pre></pre></div>', div.outerHtml,