2

Cross-posted from https://github.com/tmpvar/jsdom/issues#issue/127

I will post a minimal test case in the next day or so - but I wanted to see if anyone else had the same problem - or if (more likely) if I am doing something stupid.

I'm using NodeJS v2.6 on Ubuntu 10.04 AMD64 and [email protected].

var file = readFileSync("./www/index.html", "utf8"); var window = jsdom.jsdom(file).createWindow();

All inline scripts run, but complain about missing variables which should be supplied by the external scripts.

I have tried setting a url in the options and I have tried using full (http://...) urls in the src attributes,

I have tried jQuerify (using default jQuery path) and that works fine, though it only brings in jQuery and I'm still missing all of the other scripts.

Any pointers before I post failing code/urls?

Thanks,

Chris.

1
  • 1
    I see that you solved your issue... could you post how you did it as an answer? Commented Jan 30, 2011 at 14:59

2 Answers 2

1

As of jsdom 0.2.0 this has become much easier. Please see the "Easy mode" section in the readme. jsdom.env() will not execute scripts found in the page by default making what you are trying to do, much easier.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, I'll try 0.2.0 in a few days.
But according to the readme, jsdom.env() doesn't process external resources. "jsdom.env will not process external resources (scripts, images, etc). If you want to process the javascript use one of the methods below (jsdom.jsdom or jsdom.jQueryify)"
It is also confusing that the defaults in the Default Features section states that loading external scripts is enabled by default.
Ahh that is only for non .env() setups.
0

I removed all in-line Javascript from the page - luckily the page is under my control.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.