Skip to content
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

Does it work? multiple class #3

Closed
gibex opened this issue Mar 5, 2015 · 6 comments
Closed

Does it work? multiple class #3

gibex opened this issue Mar 5, 2015 · 6 comments

Comments

@gibex
Copy link
Contributor

gibex commented Mar 5, 2015

I'm trying to get information from .typeHighlight class from link below:
trulia.com/property/1061429905-West-End-Heights-273-Barfield-Ave-SW-Atlanta-GA-30310

Instead of 11 nodes, I get 5. It's odd because if I use a simple html, I get the right results.

@duzun
Copy link
Owner

duzun commented Mar 5, 2015

There is a bug. I'll look into it.
I started writing unit tests (#1) for this lib to find as many bugs as possible.

Thanks @gibex for pointing it out.

@gibex
Copy link
Contributor Author

gibex commented Mar 5, 2015

                                                                                  Found out that class_index has less elements for that tag. ‎I guess it's a problem in indexing classes.                                                                                                                                                                                                                                                                                                                                         Sent from Zmeura 10                                                                                                                                                                                                                From: Dumitru UzunSent: Thursday, March 5, 2015 16:06To: duzun/hQuery.phpReply To: duzun/hQuery.phpCc: Gabriel DorofteiSubject: Re: [hQuery.php] Does it work? multiple class (#3)There is a bug. I'll look into it.

I started writeing unit tests for this lib to find as many bugs as possible.

Thanks @gibex for pointing it out.

—Reply to this email directly or view it on GitHub.

@duzun
Copy link
Owner

duzun commented Mar 5, 2015

I found the reason. It is due to malformed HTML:

<img class="mapImg" src="http://static.trulia-cdn.com/images/icons/map_icon_70x70.png"">

Notice opening quote before closing > ?

What do you think would be the best workaround ?

@duzun
Copy link
Owner

duzun commented Mar 5, 2015

I improved the ::html_findTagClose() method, so that it behaves closer to a normal browser.
Now it finds 9 nodes. If you search on client side using jQuery('.typeHighlight'), you also get 9 nodes, even though there are 11 nodes with this class in HTML.

Here is the commit 4db7e4d.

@duzun
Copy link
Owner

duzun commented Mar 5, 2015

Actualy two nodes with .typeHighlight are inside <script> tags, they are not supposed to be fetched by .find().

@duzun duzun closed this as completed Mar 5, 2015
@gibex
Copy link
Contributor Author

gibex commented Mar 9, 2015

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants