Permalink
Browse files

Fixed bug where script passed to jsdom.env contains spaces

  • Loading branch information...
1 parent d047be8 commit da450d45364743768a33aff4659da47a2f6c0e27 @tomnomnom tomnomnom committed Nov 5, 2012
Showing with 12 additions and 1 deletion.
  1. +1 −1 lib/jsdom/level2/html.js
  2. +11 −0 test/level2/html.js
  3. 0 test/level2/html/files/js/script with spaces.js
View
2 lib/jsdom/level2/html.js
@@ -143,7 +143,7 @@ core.resourceLoader = {
request.end();
},
readFile: function(url, callback) {
- fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/'), 'utf8', callback);
+ fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/').replace(/%20/g, ' '), 'utf8', callback);
}
};
View
11 test/level2/html.js
@@ -19796,5 +19796,16 @@ exports.tests = {
delete String.prototype.normalize;
test.done();
+ },
+
+ filename_with_spaces_in_script_tag_can_be_read: function(test) {
+ jsdom.env(
+ '<html><head></head><body></body></html>',
+ ['./html/files/js/script with spaces.js'],
+ function(err, window){
+ test.strictEqual(err, null, "There should be no errors when using scripts with spaces in their filenames");
+ test.done();
+ }
+ );
}
}
View
0 test/level2/html/files/js/script with spaces.js
No changes.

0 comments on commit da450d4

Please sign in to comment.