Open wangzhengbo opened 4 years ago
Can you provide a failing test? I used this and it passed.
it('Splits on an HR', function() {
var html = '<p>1<hr>2</p>';
var result = splitHtml(html, 'hr');
console.info(result); // returns `[ '<p>1</p>', '<hr>', '<p>2</p>' ]`
assert(result.length === 3);
});
Can you provide a failing test? I used this and it passed.
it('Splits on an HR', function() { var html = '<p>1<hr>2</p>'; var result = splitHtml(html, 'hr'); console.info(result); // returns `[ '<p>1</p>', '<hr>', '<p>2</p>' ]` assert(result.length === 3); });
split on an HR failed in browsers(It test it with chrome 86 on Mac). but it's work well when replace br with img.
Can you provide a failing test? I used this and it passed.
it('Splits on an HR', function() { var html = '<p>1<hr>2</p>'; var result = splitHtml(html, 'hr'); console.info(result); // returns `[ '<p>1</p>', '<hr>', '<p>2</p>' ]` assert(result.length === 3); });
You can test it online at https://codesandbox.io/s/quizzical-mestorf-htzlh
I've confirmed this as a bug in the browser. It's not clear why hr
tags are being treated differently. We don't have a lot of time for this right now with focus on other projects, so we would welcome contributions for this.
Interesting. It might be possible to use the server build in the browser with cheerio.
On Wed, Oct 28, 2020 at 11:20 AM Alex Bea notifications@github.com wrote:
I've confirmed this as a bug in the browser. It's not clear why hr tags are being treated differently. We don't have a lot of time for this right now with focus on other projects, so we would welcome contributions for this.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/split-html/issues/7#issuecomment-718005824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27PGUVTANQ5GEDKCQ2TSNAZDRANCNFSM4S7GBVPA .
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his
I'm pretty sure splitting by <hr>
was working previously
splitHtml('<p>1<hr>2</p>', 'hr') failed with error: Syntax error, unrecognized expression: 1<p></p>