-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
<td> tags with no <tr> are not properly handled #422
Comments
Cheerio v0.13.1 btw (latest from what I can tell) |
The parser doesn't add opening tags. Known issue. |
I have a same question! |
@fb55 Has there been any work on this issue? Is it an issue that can be fixed or should be closed? |
@defunctzombie This can definitely be fixed, but it'll take a lot of effort. I'd like to keep this issue open as long as it's valid. |
+1 Are there any known workarounds? I have the exact same problem. |
I answered my own question. jsdom does not have this problem as it just uses jQuery. The API is a bit ugly, but it works. If you use Node.js instead of io.js then use jsdom 3.x.x. It might be worth looking at how jQuery handles this case.
var jsdom = require('jsdom').jsdom;
var window = jsdom(body).parentWindow;
jsdom.jQueryify(window, 'http://code.jquery.com/jquery-2.1.1.js', function () {
var $ = window.$;
console.log($('body').html());
}); |
What is the perf like for jsdom now? I remember that being a bit of a show On Tuesday, June 23, 2015, Ryan Pedela notifications@github.com wrote:
|
I don't know. It seems fine, but performance isn't that important for my use case. You can load a local version of jQuery to eliminate one HTTP call. |
Fixed by #985 |
I am being passed some broke-ass-html where there is a missing
<tr>
tag before a<td>
. This causes my queryies for table rows to fail as cheerio (or maybe the htmlparser) is not scoping the<td>
inside of a logical<tr>
as the browser does.The text was updated successfully, but these errors were encountered: