File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ var load = exports.load = function(html) {
244
244
} ;
245
245
246
246
var html = exports . html = function ( dom ) {
247
- if ( dom !== undefined && dom . length ) {
247
+ if ( dom !== undefined ) {
248
248
return render ( dom ) ;
249
249
} else if ( this . root && this . root . children ) {
250
250
return render ( this . root . children ) ;
Original file line number Diff line number Diff line change
1
+ var cheerio = require ( '../' ) ,
2
+ should = require ( 'should' ) ;
3
+
4
+ /*
5
+ Examples
6
+ */
7
+
8
+
9
+ describe ( '$' , function ( ) {
10
+
11
+ describe ( '.html' , function ( ) {
12
+
13
+ it ( '(html) should return innerHTML of element' , function ( ) {
14
+ var html = "<div><span>foo</span><span>bar</span></div>" ,
15
+ $ = cheerio . load ( html ) ,
16
+ span = $ ( 'div' ) . children ( ) . get ( 1 ) ;
17
+
18
+ $ ( span ) . html ( ) . should . equal ( 'bar' ) ;
19
+ $ . html ( span ) . should . equal ( '<span>bar</span>' )
20
+ } ) ;
21
+ } ) ;
22
+ } ) ;
You can’t perform that action at this time.
0 commit comments