jsdom icon indicating copy to clipboard operation
jsdom copied to clipboard

Addings scripts to jsdom.env() seems not to run callback.

Open intinig opened this issue 15 years ago • 5 comments

(function() {
  var jsdom;
  jsdom = require('jsdom');
  jsdom.env({
    html: "<html><head></head><body><p>ciao</p></body></html>",
    done: function(errors, window) {
      return console.log(window.location.href);
    }
  });
}).call(this);

seems to run fine, while

(function() {
  var jsdom;
  jsdom = require('jsdom');
  jsdom.env({
    html: "<html><head></head><body><p>ciao</p></body></html>",
    scripts: ['https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js'],
    done: function(errors, window) {
      return console.log(window.location.href);
    }
  });
}).call(this);

doesn't do anything. It just gives no output.

Using node 0.4.10, jsdom 0.2.1

intinig avatar Aug 24 '11 07:08 intinig

can you try console.log('here')? it is possible that window.location.href is an empty string?

tmpvar avatar Aug 24 '11 16:08 tmpvar

Unfortunately nothing happens :(


(function() {
  var jsdom;
  jsdom = require('jsdom');
  jsdom.env({
    html: "<html><head></head><body><p>ciao</p></body></html>",
    scripts: ['https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js'],
    done: function(errors, window) {
      return console.log('hi mom');
    }
  });
}).call(this);

intinig avatar Aug 25 '11 07:08 intinig

looks like jsdom is not compatible with jquery 1.6.2 -- errors would be nice in this case. thank you for reporting this

tmpvar avatar Aug 25 '11 16:08 tmpvar

It looks like this was an issue with fetching things over https. I tested out other scripts over https and got the same thing, but they worked over http. I think my pull request should fix this (https://github.com/tmpvar/jsdom/pull/283).

brianmcd avatar Aug 25 '11 18:08 brianmcd

landed 9565feb7829823d846ed7164e4494e0936a94945

tmpvar avatar Sep 02 '11 03:09 tmpvar