foreign.html (1795B)
1 <!DOCTYPE html> 2 <html lang="en" foo='bar'> 3 <head foo='bar'> 4 <meta charset="utf-8" foo='bar'> 5 <title id='title' foo='bar'>Foreign content</title> 6 <link rel="author" title="Philippe Le Hegaret" href="mailto:plh@w3.org" foo='bar'> 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/#extensibility" foo='bar'> 8 <script src="/resources/testharness.js" foo='bar'></script> 9 <script src="/resources/testharnessreport.js" foo='bar'></script> 10 </head> 11 12 <body foo='bar'> 13 14 <p class='assert' foo='bar'>User agents must treat elements and attributes that they do not understand as semantically neutral; leaving them in the DOM (for DOM processors), and styling them according to CSS (for CSS processors), but not inferring any meaning from them.</p> 15 16 <foo foo='bar' echo>Foobar</foo> 17 18 <div id="log">Running test...</div> 19 20 <script> 21 var t = async_test("foreign content"); 22 23 on_event(window, "load", 24 t.step_func(function() { 25 var nodes = document.getElementsByTagName("*"); 26 var cont = true; 27 var last = null; 28 for(var i=0;i<nodes.length && cont; i++) { 29 var as = nodes.item(i).getAttribute("foo"); 30 if (!(as === "bar") && (nodes.item(i).getAttribute("id") === "log")) { 31 cont = false; 32 } else { 33 last = nodes.item(i); 34 assert_equals(as, "bar"); 35 } 36 } 37 38 assert_equals(last.nodeName, "FOO"); 39 assert_equals(last.getAttribute("echo"), ""); 40 assert_equals(last.getAttribute("charly"), null); 41 t.done(); 42 })); 43 </script> 44 </body> 45 </html>