MatthewMueller/cheerio — Issue #7: .text() not working for empty elements
Author: sstur
Created: 2011-11-08 04:34:28+00:00
State: open

there seems to be a problem with setting text into an empty div like so:

var cheerio = require('cheerio');
var $ = cheerio.load('

');
$('#one').text('Hello there!');
$.html();

the problem appears to be that line 118 of api/manipulation.coffee is checking that this.children exists before inserting the element.

i'm not sure if this is an issue in cheerio or an issue with htmlparser leaving the children property unassigned, but i though you might want to know.

cheers,
simon