MatthewMueller/cheerio — Issue #13: Cannot handle a full HTML page
Author: iMeow
Created: 2011-12-04 09:15:58+00:00
State: open

I just started using Cheerio and it seems like a great tool. Trying some of the examples on the Cheerio page worked as advertised but when I pass Cheerio a full HTML page, it cannot seem to process it.

This is the HTML I am using:

```

Copyright © Moo cows. All rights reserved.

```

If I try $('title').html('moo') I get "TypeError: Cannot read property '0' of undefined". If I try $('#logo').after('moo') I get "TypeError: Cannot call method 'find' of undefined". When I try $('.year').html('moo') I don't get any error but the change isn't made either. If I don't perform any manipulations and just output $.html(), no error is thrown. (However, it does bork my conditional statements—should I open a separate Issue?)

I don't know if this is in any way related to Issue #12 but the error messages are similar. I tried to narrow down the problem by stripping out some of the script tags, conditional statements, etc from the HTML but that didn't work either.

I am using the latest version of Node.js (0.6.4).