.html() can return null

.html() can return null when querying an element that does not exist. 

Repro:

        const response = await axios.default.get('https://www.google.com/')
        const $ = cheerio.load(response.data)
        const foo = $('.bar').html()
        console.log(`foo is: ${foo}`) //foo is: null
This commit is contained in:
isMeCoder
2017-10-30 10:11:20 -07:00
committed by GitHub
parent 1cf7a72cb6
commit 5bca979247

View File

@@ -172,7 +172,7 @@ interface Cheerio {
empty(): Cheerio;
html(): string;
html(): string | null;
html(html: string): Cheerio;
text(): string;