Closed Bug 1218242 Opened 9 years ago Closed 8 years ago

Reader View eliminates article code's comments if they have "comment" in a class

Categories

(Toolkit :: Reader Mode, defect)

41 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1199651

People

(Reporter: leewangzhong, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0
Build ID: 20151014143721

Steps to reproduce:

Take a page on which Firefox allows "Reader View". Take one of the article's paragraph nodes and add the class "not-a-comment" to it. Click "Reader View".


Actual results:

That paragraph doesn't appear in Reader View.


Expected results:

It should.

----

As a real-world example, the following article uses the class "md-code-comment" to style comments within code examples:
https://ponyfoo.com/articles/es6-promises-in-depth
(archived: https://web.archive.org/web/20150928184517/http://ponyfoo.com/articles/es6-promises-in-depth)

Here's the code that strips out these nodes.
https://github.com/mozilla/readability/blob/a801846a456db91df31b6f3b150f2c15619bcb1a/Readability.js#L650

Here's the regex that decides it. ('unlikelyCandidates')
https://github.com/mozilla/readability/blob/a801846a456db91df31b6f3b150f2c15619bcb1a/Readability.js#L110

There are definitely uses for /.*comment.*/ classes. Maybe none of those unlikelyCandidate tags should be removed if they're the subnode of a "candidate" node with text, since at that point you already predicted that you're inside the article text.
Component: Untriaged → Reader Mode
OS: Unspecified → All
Product: Firefox → Toolkit
Hardware: Unspecified → All
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.