Fix bug in HTML rendering in Node.js

When supplied with a Cheerio instance (instead of a string of HTML), the
Node.js-specific `html` and `append` methods should reference the
complete outer HTML (not just the contents) as generated by Cheerio's
`render` method.
This commit is contained in:
Mike Pennisi
2012-09-29 10:19:58 -04:00
parent 284fe4a35d
commit d60cf1222c
+2 -2
View File
@@ -99,13 +99,13 @@ var $ = require("cheerio");
// element to replace the innerHTML with.
html: function(root, el) {
var $root = root[0] ? root : $(root);
$root.html(_.isString(el) ? el : $(el).html());
$root.html(_.isString(el) ? el : $.render(el));
},
// Very similar to HTML except this one will appendChild.
append: function(root, el) {
var $root = root[0] ? root : $(root);
$root.append(_.isString(el) ? el : $(el).html());
$root.append(_.isString(el) ? el : $.render(el));
},
when: function(promises) {