forked from sheetjs/sheetjs
Remove closing >
of <br> tag
Use get_dom_element
This commit is contained in:
parent
825830d1cd
commit
1ab13069cb
@ -164,7 +164,7 @@ var matchtag = (function() {
|
||||
})();
|
||||
|
||||
function htmldecode(str/*:string*/)/*:string*/ {
|
||||
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?/g,"\n").replace(/<[^>]*>/g,"").replace(/ /g, " ");
|
||||
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g,"\n").replace(/<[^>]*>/g,"").replace(/ /g, " ");
|
||||
}
|
||||
|
||||
var vtregex = (function(){ var vt_cache = {};
|
||||
|
5
test.js
5
test.js
@ -1861,6 +1861,11 @@ describe('HTML', function() {
|
||||
(domtest ? describe : describe.skip)('input DOM', function() {
|
||||
it('should interpret values by default', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str)), false, true); });
|
||||
it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); });
|
||||
it('should handle newlines correctly', function() {
|
||||
var table = get_dom_element("<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>");
|
||||
var wb = X.utils.table_to_book(table)
|
||||
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1861,6 +1861,12 @@ describe('HTML', function() {
|
||||
(domtest ? describe : describe.skip)('input DOM', function() {
|
||||
it('should interpret values by default', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str)), false, true); });
|
||||
it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); });
|
||||
it('should handle newlines correctly', function() {
|
||||
var table = document.createElement('table');
|
||||
table.innerHTML = "<tr><td>foo<br/>bar</td><td>baz</td></tr>";
|
||||
var wb = X.utils.table_to_book(table)
|
||||
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -2174,7 +2174,7 @@ var matchtag = (function() {
|
||||
})();
|
||||
|
||||
function htmldecode(str/*:string*/)/*:string*/ {
|
||||
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?/g,"\n").replace(/<[^>]*>/g,"").replace(/ /g, " ");
|
||||
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g,"\n").replace(/<[^>]*>/g,"").replace(/ /g, " ");
|
||||
}
|
||||
|
||||
var vtregex = (function(){ var vt_cache = {};
|
||||
|
2
xlsx.js
2
xlsx.js
@ -2102,7 +2102,7 @@ var matchtag = (function() {
|
||||
})();
|
||||
|
||||
function htmldecode(str) {
|
||||
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?/g,"\n").replace(/<[^>]*>/g,"").replace(/ /g, " ");
|
||||
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g,"\n").replace(/<[^>]*>/g,"").replace(/ /g, " ");
|
||||
}
|
||||
|
||||
var vtregex = (function(){ var vt_cache = {};
|
||||
|
Loading…
Reference in New Issue
Block a user