I'm really enjoying Cheerio, but have hit a wall with .CSS() method.
var request = require('request'),
cheerio = require("cheerio");
var arbitraryPage = 'http://www.bonobos.com/slim-red-and-navy-tattersall-oxford-shirt-for-men';
request(arbitraryPage, function(err, resp, html){
$ = cheerio.load(html);
$('.price').css('color'); //UNDEFINED
});
Am I missing something? Do I need to import the css like jsDom?
@becush Cheerio operates over a DOM-like structure generated through string parsing only. This allows it to be much faster than jsDom at the cost of some fidelity. In this case, because Cheerio does not actually parse and apply CSS, the css method can only return styling that has been applied in-line via the style attribute. If you need to do more advanced CSS scraping, I would recommend using jsDom.
Ok, thanks! I'll pull documentation to update.
Hello, why can't simple styles be obtained?
url:http://nipponcolors.com/#nadeshiko

this will return {}, why?
Most helpful comment
Hello, why can't simple styles be obtained?
url:http://nipponcolors.com/#nadeshiko
this will return {}, why?