You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This not an issue for your project. I just wanted to pass along a comment I just posted on the jsdom github site:
...
I reported on this issue, see #290. Inspired by this post (#328), I also tried the html5 parser. Code snippet:
request(url, function (error, response, body) {
if (error) {
onError(message, error, socket);
} else {
var window = jsdom.jsdom(null, null, { parser : html5 }).createWindow();
var parser = new html5.Parser({ document: window.document });
parser.parse(body);
jsdom.jQueryify(window, jQueryLib, function(window, jquery) {
var $ = window.$;
// Do work...
});
}
});
This pattern can be found on the htlm5 github site. While I was able to pass in 'features' options (as detailed above), the jsdom.jQueryify function appears to overwrite the feature's settings. See jsdom.js (lines 122-4):
Naturally, I wanted to set these to false to avoid script processing. My only option was to edited the code, setting all 3 features to false. It would be nice if the global defaultDocumentFeatures function worked as expected or the jQueryify function signature provided for options/features.
...
So using the html5 parser allows me to circumvent the jsdom 'hierarchy request' error. But the integration between html5 and jsdom does not allow me to disable target features. Unless, I'm missing something.
The text was updated successfully, but these errors were encountered:
Given the above use case, the jsdom.jQueryify function should (1) provide an options parameter or (2) honor jsdom.jsdom options and/or global options. Doesn't that sound about right?
This not an issue for your project. I just wanted to pass along a comment I just posted on the jsdom github site:
...
I reported on this issue, see #290. Inspired by this post (#328), I also tried the html5 parser. Code snippet:
This pattern can be found on the htlm5 github site. While I was able to pass in 'features' options (as detailed above), the jsdom.jQueryify function appears to overwrite the feature's settings. See jsdom.js (lines 122-4):
122 window.document.implementation.addFeature('FetchExternalResources', ['script']);
123 window.document.implementation.addFeature('ProcessExternalResources', ['script']);
124 window.document.implementation.addFeature('MutationEvents', ["1.0"]);
Naturally, I wanted to set these to false to avoid script processing. My only option was to edited the code, setting all 3 features to false. It would be nice if the global defaultDocumentFeatures function worked as expected or the jQueryify function signature provided for options/features.
...
So using the html5 parser allows me to circumvent the jsdom 'hierarchy request' error. But the integration between html5 and jsdom does not allow me to disable target features. Unless, I'm missing something.
The text was updated successfully, but these errors were encountered: