diff --git a/bits/79_html.js b/bits/79_html.js index 4867930..c341e69 100644 --- a/bits/79_html.js +++ b/bits/79_html.js @@ -38,7 +38,7 @@ var HTML_ = (function() { m = htmldecode(m); if(range.s.r > R) range.s.r = R; if(range.e.r < R) range.e.r = R; if(range.s.c > C) range.s.c = C; if(range.e.c < C) range.e.c = C; - if(!m.length) continue; + if(!m.length) { C += CS; continue; } var o/*:Cell*/ = {t:'s', v:m}; if(opts.raw || !m.trim().length || _t == 's'){} else if(m === 'TRUE') o = {t:'b', v:true}; diff --git a/test.js b/test.js index c52e8ad..713307c 100644 --- a/test.js +++ b/test.js @@ -2286,6 +2286,20 @@ describe('HTML', function() { assert.equal(X.utils.sheet_to_csv(ws), "A,B\n1,2\n3,4\n4,6"); }); }); + describe('empty cell containing html element should increment cell index', function() { + var html = "
abc def
"; + var expectedCellCount = 3; + it('HTML string', function() { + var ws = X.read(html, {type:'string'}).Sheets.Sheet1; + var range = X.utils.decode_range(ws['!ref']); + assert.equal(range.e.c,expectedCellCount - 1); + }); + if(domtest) it('DOM', function() { + var ws = X.utils.table_to_sheet(get_dom_element(html)); + var range = X.utils.decode_range(ws['!ref']); + assert.equal(range.e.c, expectedCellCount - 1); + }); + }); }); describe('js -> file -> js', function() {