如何獲得選擇器的css屬性?有Cheerio獲得類屬性
HTML
<body>
<a class="my_class" href="/" title="link"/>
</body>
和JS代碼中的一些屬性my_class
.my_class {
color: red
}
我使用cheerio lib目錄下:
var content = cheerio.load(html_content_page);
var selector = "a.my_class";
所以,我怎樣才能得到color
財產使用上面的選擇?
好使用
getComputedStyle()
在樣式表聲明的內嵌樣式或規則片段,回答類似的問題來自維護人員:https://github.com/cheeriojs/cheerio/issues/357#issuecomment-31659300 – Bob