Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/base/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 5 kB image not shown  

SSL test_bug744830.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/base/test/test_bug744830.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=744830
-->

<head>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<pre id="test">
<script type="application/javascript">
  var t = document.getElementById('testnodes');
  is(t.innerHTML,
     "hi there ",
     "comment nodes should be included");

  var PI = document.createProcessingInstruction('foo''bar="1.0"');
  t.appendChild(PI);
  is(t.innerHTML, 'hi there ',
    "pi nodes should be included");

  t.innerHTML = null;
  t.appendChild(document.createElement("textarea"));
  t.firstChild.appendChild(document.createTextNode("\nhello"));
  // This is the old behavior. Spec requires something else.
  is(t.innerHTML, "",
     "No extra newlines should be inserted to the textarea!");

  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.w3.org/2000/svg""svg:svg"));
  t.firstChild.textContent = "";
  is(t.innerHTML, "<foo>");

  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML""math:math"));
  t.firstChild.textContent = "";
  is(t.innerHTML, "<foo>");

  // Prefix is serialized if element isn't HTML/SVG/MathML
  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.example.org""ex:example"));
  t.firstChild.textContent = "";
  is(t.innerHTML, "<foo>");

  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.example.org""example"));
  t.firstChild.textContent = "";
  is(t.innerHTML, "<foo>");

  t.firstChild.setAttributeNS("http://www.w3.org/XML/1998/namespace""xml:lang""us-en");
  is(t.innerHTML, '<foo>');

  t.firstChild.setAttributeNS("http://www.w3.org/1999/xlink""href""foo");
  is(t.innerHTML, '<foo>');

  t.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/""xmlns""http://foo");
  is(t.innerHTML, '<foo>');

  t.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/""xmlns:bar""http://bar");
  is(t.innerHTML, '<foo>');

  t.firstChild.setAttributeNS("http://www.helloworldns.org""hello:world""!");
  is(t.innerHTML, '<foo>');

  t.firstChild.setAttribute("foo"'-"&\xA0-');
  is(t.innerHTML, '<foo>');

  t.innerHTML = null;
  t.appendChild(document.createElement("div"));
  t.firstChild.appendChild(document.implementation
                                   .createDocument(null, null, null)
                                   .createCDATASection("foo"));
  is(t.innerHTML, '
foo
'
);

  t.firstChild.textContent = "1&2<3>4\xA0";
  is(t.innerHTML, '
1&2<3>4 
'
);

  t.innerHTML = null;
  t.appendChild(document.createElement("script"));
  t.firstChild.textContent = "1&2<3>4\xA0";
  is(t.innerHTML, '