OLD | NEW |
(Empty) | |
| 1 const DocumentTypes = [ |
| 2 { |
| 3 name: 'document', |
| 4 create: function () { return Promise.resolve(document); }, |
| 5 isOwner: true, |
| 6 hasBrowsingContext: true, |
| 7 }, |
| 8 { |
| 9 name: 'document of a template element', |
| 10 create: function () { |
| 11 return new Promise(function (resolve) { |
| 12 var template = document.createElementNS('http://www.w3.org/1999/
xhtml', 'template'); |
| 13 var doc = template.content.ownerDocument; |
| 14 if (!doc.documentElement) |
| 15 doc.appendChild(doc.createElement('html')); |
| 16 resolve(doc); |
| 17 }); |
| 18 }, |
| 19 hasBrowsingContext: false, |
| 20 }, |
| 21 { |
| 22 name: 'new document', |
| 23 create: function () { |
| 24 return new Promise(function (resolve) { |
| 25 var doc = new Document(); |
| 26 doc.appendChild(doc.createElement('html')); |
| 27 resolve(doc); |
| 28 }); |
| 29 }, |
| 30 hasBrowsingContext: false, |
| 31 }, |
| 32 { |
| 33 name: 'cloned document', |
| 34 create: function () { |
| 35 return new Promise(function (resolve) { |
| 36 var doc = document.cloneNode(false); |
| 37 doc.appendChild(doc.createElement('html')); |
| 38 resolve(doc); |
| 39 }); |
| 40 }, |
| 41 hasBrowsingContext: false, |
| 42 }, |
| 43 { |
| 44 name: 'document created by createHTMLDocument', |
| 45 create: function () { |
| 46 return Promise.resolve(document.implementation.createHTMLDocument())
; |
| 47 }, |
| 48 hasBrowsingContext: false, |
| 49 }, |
| 50 { |
| 51 name: 'HTML document created by createDocument', |
| 52 create: function () { |
| 53 return Promise.resolve(document.implementation.createDocument('http:
//www.w3.org/1999/xhtml', 'html', null)); |
| 54 }, |
| 55 hasBrowsingContext: false, |
| 56 }, |
| 57 { |
| 58 name: 'document in an iframe', |
| 59 create: function () { |
| 60 return new Promise(function (resolve, reject) { |
| 61 var iframe = document.createElement('iframe'); |
| 62 iframe.onload = function () { resolve(iframe.contentDocument); } |
| 63 iframe.onerror = function () { reject('Failed to load an empty i
frame'); } |
| 64 document.body.appendChild(iframe); |
| 65 }); |
| 66 }, |
| 67 hasBrowsingContext: true, |
| 68 }, |
| 69 { |
| 70 name: 'HTML document fetched by XHR', |
| 71 create: function () { |
| 72 return new Promise(function (resolve, reject) { |
| 73 var xhr = new XMLHttpRequest(); |
| 74 xhr.open('GET', 'resources/empty-html-document.html'); |
| 75 xhr.overrideMimeType('text/xml'); |
| 76 xhr.onload = function () { resolve(xhr.responseXML); } |
| 77 xhr.onerror = function () { reject('Failed to fetch the document
'); } |
| 78 xhr.send(); |
| 79 }); |
| 80 }, |
| 81 hasBrowsingContext: false, |
| 82 } |
| 83 ]; |
OLD | NEW |