Created
April 29, 2012 16:46
-
-
Save pccowboy/2551818 to your computer and use it in GitHub Desktop.
Test of createWindow from contextify, as used by jsdom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = new DOMWindow(options); | |
Contextify(window); | |
// We need to set up self references using Contextify's getGlobal() so that | |
// the global object identity is correct (window === this). | |
// See Contextify README for more info. | |
var global = window.getGlobal(); | |
// Set up the window as if it's a top level window. | |
// If it's not, then references will be corrected by frame/iframe code. | |
// Note: window.frames is maintained in the HTMLFrameElement init function. | |
window.window = window.frames | |
= window.self | |
= window.parent | |
= window.top = global; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = new DOMWindow(options); | |
Contextify(window); | |
// We need to set up self references using Contextify's getGlobal() so that | |
// the global object identity is correct (window === this). | |
// See Contextify README for more info. | |
var global = window.getGlobal(); | |
// Set up the window as if it's a top level window. | |
// If it's not, then references will be corrected by frame/iframe code. | |
// Note: window.frames is maintained in the HTMLFrameElement init function. | |
window.window = window.frames | |
= window.self | |
= window.parent | |
= window.top = global; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = new DOMWindow(options); | |
Contextify(window); | |
// We need to set up self references using Contextify's getGlobal() so that | |
// the global object identity is correct (window === this). | |
// See Contextify README for more info. | |
var global = window.getGlobal(); | |
// Set up the window as if it's a top level window. | |
// If it's not, then references will be corrected by frame/iframe code. | |
// Note: window.frames is maintained in the HTMLFrameElement init function. | |
window.window = window.frames | |
= window.self | |
= window.parent | |
= window.top = global; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = new DOMWindow(options); | |
Contextify(window); | |
// We need to set up self references using Contextify's getGlobal() so that | |
// the global object identity is correct (window === this). | |
// See Contextify README for more info. | |
var global = window.getGlobal(); | |
// Set up the window as if it's a top level window. | |
// If it's not, then references will be corrected by frame/iframe code. | |
// Note: window.frames is maintained in the HTMLFrameElement init function. | |
window.window = window.frames | |
= window.self | |
= window.parent | |
= window.top = global; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
u=require('util') | |
j=require('node.io/node_modules/jsdom/lib/jsdom/browser/index.js') | |
w=j.createWindow('<html></html>',{}) | |
u.puts(u.inspect(w.navigator)) | |
{ userAgent: 'Node.js (linux; U; rv:v0.6.15)', | |
appName: 'Node.js jsDom', | |
platform: 'linux', | |
appVersion: 'v0.6.15' } | |
undefined | |
u.puts(u.inspect(w.window.navigator)) | |
undefined | |
undefined | |
if (w === w.window) {u.puts('ok');} else {u.puts('not setting up global from contextify');} | |
not setting up global from contextify | |
undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the duplicate files from jsdom - gist seems to not want me to remove them, every time I try it seem to add another back.