-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property '_ownerDocument' of undefined #266
Comments
please provide some context. which method are you using? what does the markup look like? etc.. On Aug 2, 2011, at 1:01 PM, level09 wrote:
|
Here is the HTML : https://gist.github.com/1121208 that used to work fine with older versions of jsdom. let me know if I can provide more details. |
the method is jsdom.env(html, [scripts],function(err,window) { }) |
what scripts are you injecting? On Aug 2, 2011, at 3:29 PM, level09 wrote:
|
I am only injecting latest jquery : http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js |
weird. thanks for reporting On Aug 2, 2011, at 3:36 PM, level09 wrote:
|
I came across this error and was able to reduce it to this test case: var jsdom = require('jsdom').jsdom;
var doc = jsdom('<html><body><input value="<"></body></html>'); The original document had "<" in an attribute value and was considered valid according to the W3C validator, but triggered this error. |
makes sense, this looks like its a node-htmlparser issue |
Just wanted to report probably the same error, my reduced test case was '<< prev' |
ups... <html><body><< prev</body></html> |
I also had this problem. When I use jsdom.env to open www.amazon.com, this error will occur. It is related to html parse. But I do not know how to fix it. Any solution? |
there are two routes we can take.
|
already reported to node-htmlparser |
What work is involved in the second route? Is it something I could help with? |
Just so it's clear, I'm not sold on the name "trigger" but the work to rename it should be done separately |
#279 should fix this issue without needing to enter a try/catch block |
The crash is no longer present, so this reduces to a duplicate of #494. |
I still have this issue by using a custom html tag: jsdom.env('<!doctype html><html><head></head><body><' + myComponent +'/></body></html>', function (errors, window) {
global.document = window.document
console.log(document.body.innerHTML) // <my-component></my-component>
}) |
@GianlucaGuarini please open a new bug instead of commenting on an old bug; include the full error thrown with the stack trace, and make sure you are using the latest version of jsdom, 4.0.1 on io.js. |
/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/level1/core.js:458
if (!newChild._ownerDocument) newChild._ownerDocument = this._ownerDocumen
^
TypeError: Cannot read property '_ownerDocument' of undefined
at Object. (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/level1/core.js:458:18)
at Object.insertBefore (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/level2/events.js:325:20)
at Object.appendChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/level1/core.js:574:17)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:167:17)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:163:7)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:163:7)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:163:7)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:163:7)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:163:7)
at setChild (/usr/local/lib/node/.npm/jsdom/0.2.1/package/lib/jsdom/browser/htmltodom.js:163:7)
The text was updated successfully, but these errors were encountered: