| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <iframe id="xmlframe" onload="frameLoaded()" style="height:0px" src="data:application/xhtml+xml,<?xml version='1.0' encoding='UTF-8'?><body/>"></iframe> |
| <script> |
| description('Test DOMJIT nodeType accessor works.'); |
| |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| |
| var target = null; |
| var result = null; |
| function runTest() |
| { |
| var xmlDocument = document.getElementById('xmlframe').contentDocument; |
| var targets = [ |
| ['Element', document.body, document], |
| ['Attr', document.createAttribute('Cocoa'), document], |
| ['Text', document.createTextNode('Cocoa'), document], |
| ['CDATA', xmlDocument.createCDATASection('test'), xmlDocument], |
| ['ProcessingInstruction', xmlDocument.createProcessingInstruction('target', 'test'), xmlDocument], |
| ['Comment', document.createComment('Cocoa'), document], |
| ['Document', document, null], |
| ['XMLDocument', xmlDocument, null], |
| ['DocumentType', document.doctype, document], |
| ['DocumentFragment', document.createDocumentFragment(), document], |
| ]; |
| |
| for ([name, target, result] of targets) { |
| var text = ` |
| function test${name}(element, result) |
| { |
| for (var i = 0; i < 1e4; ++i) { |
| if (element.ownerDocument !== result) |
| return false; |
| } |
| return true; |
| } |
| `; |
| shouldBeTrue(`(${text})(target, result)`); |
| } |
| |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| function frameLoaded() |
| { |
| runTest(); |
| } |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |