Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

2.0 KB
Raw Blame
<!doctype html>
<meta charset="windows-1252">
<script src="/wpt/resources/testharness.js"></script>
<script src="/wpt/resources/testharnessreport.js"></script>
<script src="/wpt/resources/moli-wpt-adapter.js"></script>
<script>
test(function () {
  const doc = new Document();

  assert_true(doc instanceof Node, "instanceof Node");
  assert_true(doc instanceof Document, "instanceof Document");
  assert_false(doc instanceof XMLDocument, "not an XMLDocument");
}, "new Document() exposes the Document interface");

test(function () {
  const doc = new Document();

  assert_equals(doc.firstChild, null, "firstChild");
  assert_equals(doc.lastChild, null, "lastChild");
  assert_equals(doc.doctype, null, "doctype");
  assert_equals(doc.documentElement, null, "documentElement");
  assert_array_equals(doc.childNodes, [], "childNodes");
}, "new Document() starts without children");

test(function () {
  const doc = new Document();

  assert_equals(doc.location, null, "location");
  assert_equals(doc.URL, "about:blank", "URL");
  assert_equals(doc.documentURI, "about:blank", "documentURI");
  assert_equals(doc.compatMode, "CSS1Compat", "compatMode");
  assert_equals(doc.characterSet, "UTF-8", "characterSet");
  assert_equals(doc.contentType, "application/xml", "contentType");
  assert_equals(doc.createElement("DIV").localName, "DIV", "plain Document createElement casing");
  assert_equals(doc.createElement("a").constructor, Element, "plain Document createElement interface");
}, "new Document() exposes XML document metadata");

test(function () {
  const doc = new Document();

  assert_equals(doc.characterSet, "UTF-8", "characterSet");
  assert_equals(doc.charset, "UTF-8", "charset");
  assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");
}, "new Document() exposes characterSet aliases");

test(function () {
  const doc = new Document();
  const a = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");

  assert_equals(a.constructor, HTMLAnchorElement, "HTML namespace interface");
}, "new Document() creates HTML namespace elements with HTML interfaces");
</script>