Comparing version
@@ -61,26 +61,46 @@ var sys = require('sys'), | ||
}; | ||
/* | ||
inheritance from a native object | ||
http://www.mail-archive.com/v8-users@googlegroups.com/msg02170.html | ||
function Derived(args) { | ||
var base = new Base(); | ||
base.__proto__ = Derived.prototype; | ||
return base; | ||
} | ||
Derived.prototype = {__proto__: Base.prototype, constructor: Derived }; | ||
*/ | ||
//process.binding('evals').Context | ||
var Context=process.binding('evals').Context; | ||
function DOMWindow(dom, options) { | ||
this.frames = [this]; | ||
this.contentWindow = this; | ||
this.window = this; | ||
this.self = this; | ||
var base = new Context(); | ||
base.__proto__ = DOMWindow.prototype; | ||
base.frames = [base]; | ||
base.contentWindow = base; | ||
base.window = base; | ||
base.self = base; | ||
var href = (options || {}).url || __filename; | ||
this.location = URL.parse(href); | ||
this.location.reload = NOT_IMPLEMENTED; | ||
this.location.replace = NOT_IMPLEMENTED; | ||
this.location.toString = function() { | ||
base.location = URL.parse(href); | ||
base.location.reload = NOT_IMPLEMENTED; | ||
base.location.replace = NOT_IMPLEMENTED; | ||
base.location.toString = function() { | ||
return href; | ||
}; | ||
var window = this; | ||
this.addEventListener = function() { | ||
var window = base; | ||
base.addEventListener = function() { | ||
dom.Node.prototype.addEventListener.apply(window, arguments); | ||
}; | ||
this.dispatchEvent = function() { | ||
base.dispatchEvent = function() { | ||
dom.Node.prototype.dispatchEvent.apply(window, arguments); | ||
}; | ||
return base; | ||
} | ||
DOMWindow.prototype = { | ||
__proto__: Context.prototype, constructor: DOMWindow, | ||
get document() { | ||
@@ -87,0 +107,0 @@ return this._document; |
@@ -63,7 +63,7 @@ var core = require("./core").dom.level2.core, | ||
baseUrl = document.URL; | ||
if (baseElements.length > 0) { | ||
baseUrl = baseElements.item(0).href; | ||
} | ||
return URL.resolve(baseUrl, path).replace(/^file:\/\//, ''); | ||
@@ -91,2 +91,4 @@ }, | ||
}); | ||
request.on('error', callback); | ||
request.end(); | ||
@@ -106,4 +108,13 @@ }, | ||
var ev = this.ownerDocument.createEvent("MutationEvents") | ||
ev.initMutationEvent("DOMCharacterDataModified", true, false, this, oldValue, newValue, null, null) | ||
this.dispatchEvent(ev) | ||
ev.initMutationEvent("DOMCharacterDataModified", | ||
true, | ||
false, | ||
this, | ||
oldValue, | ||
value, | ||
null, | ||
null); | ||
this.dispatchEvent(ev); | ||
} | ||
@@ -397,3 +408,3 @@ }); | ||
}, | ||
set head() { /* noop */ }, | ||
@@ -400,0 +411,0 @@ |
@@ -5,17 +5,11 @@ | ||
if (window) { | ||
if (!window.__javascriptEval) { | ||
// Yeah, its hackery, but it works | ||
var Script = process.binding('evals').Script, | ||
setupCode = "function __javascriptEval(c, w, f) { runInNewContext(c, w, f); }"; | ||
window.runInNewContext = Script.runInNewContext; | ||
Script.runInNewContext(setupCode, window); | ||
} | ||
var tracelimitbak=Error.stackTraceLimit; | ||
Error.stackTraceLimit = 100 | ||
try { | ||
window.__javascriptEval(code, window, filename); | ||
process.binding('evals').Script.runInContext(code,window,filename) | ||
} catch(e) { | ||
console.log(e.stack); | ||
} | ||
Error.stackTraceLimit = tracelimitbak; | ||
} | ||
}; | ||
}; |
{ | ||
"name": "jsdom", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"description": "CommonJS implementation of the DOM intended to be platform independent and as minimal/light as possible while completely adhering to the w3c DOM specifications.", | ||
@@ -44,2 +44,6 @@ "keywords": [ | ||
"email" : "unknown" | ||
}, | ||
{ | ||
"name" : "Shimon Dookdin", | ||
"email" : "helpmepro1@gmail.com" | ||
} | ||
@@ -46,0 +50,0 @@ ], |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
76776674
0140570
0.01%