Conversation
These HTML5 phrasing elements were omitted from PHRASING_ELEMS, so DIV wrapping treated them as blocks and split paragraphs around them.
A single nested br does not become a paragraph, so skipping those siblings dropped the paragraph created by an earlier br-br chain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #997.
PHRASING_ELEMSalready includedBandBDObut notU,S, orBDI. When Readability wraps a DIV's phrasing children into<p>tags, those tags were treated as breaks, sobecame
and
excerptstopped at "Seigneur, mon Die". Same split for<s>,<bdi>, and for<a>that contains<u>.The sample in the issue is a
<p>. Wrapping of consecutive phrasing children only runs onDIV; a<p>that already contains<u>is left alone. The incorrect output in the issue is the DIV-wrapping result, which is what the test page uses.Summary
U,S, andBDItoPHRASING_ELEMS(same list asB/BDO, matching HTML phrasing content)._replaceBrs, do not pull a phrasing sibling that contains a<br><br>chain into the new<p>. Those chains become paragraphs next; wrapping them nests<p>inside<p>/<u>, and jsdom and JSDOMParser then disagree, sohukumusumecannot stay green on both parsers. A single nested<br>is still pulled in (it does not become a paragraph).phrasing-u-s-bdiwith the reporter's underline example plus<s>and<bdi>inside DIVs.Decision
U,S,BDI. Alternative: alsoPICTURE/MAP/AREA/SLOT/TEMPLATE. Reasoning: those three are what PHRASING_ELEMS missing <u>, <s>, and <bdi> elements causes paragraph splitting #997 asked for, and the list already deliberately omits some phrasing tags (CANVAS,IFRAME,SVG,VIDEO). Happy to add more if you want._replaceBrsskip when a phrasing node contains a<br><br>chain, rather than regeneratinghukumusume/expected.html. Alternative: regenerate that fixture. Reasoning: JSDOMParser and jsdom then disagree on nested<p>inside<u>. Happy to switch if you want a parser picked as source of truth.Test plan
npm test -- -g phrasing-u-s-bdi(jsdom + JSDOMParser)npm test(existing pages, including hukumusume)npm run lint<u>/<s>/<bdi>inside DIV-wrapped paragraphs in Firefox Reader View