Closed
Bug 1144441
Opened 10 years ago
Closed 10 years ago
topCandidate code in Readability.js does silly loop manipulations which leave half the elements
Categories
(Toolkit :: Reader Mode, defect)
Toolkit
Reader Mode
Tracking
()
RESOLVED
FIXED
Iteration:
39.2 - 23 Mar
People
(Reporter: Gijs, Assigned: Gijs)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
Like bug 1127778:
var topCandidate = topCandidates[0] || null;
// If we still have no top candidate, just use the body as a last resort.
// We also have to copy the body node so it is something we can modify.
if (topCandidate === null || topCandidate.tagName === "BODY") {
// Move all of the page's children into topCandidate
topCandidate = doc.createElement("DIV");
var children = page.childNodes;
for (var i = 0; i < children.length; ++i) {
this.log("Moving children:", children[i]);
topCandidate.appendChild(children[i]);
}
page.appendChild(topCandidate);
this._initializeNode(topCandidate);
}
this loop is sad, because it will move out every other kid (and leave the others) because the appendChild call will remove the kid.
That's not good. A naive fix unfortunately didn't immediately fix everything, because we then created an extra div layer for the simple testcase from bug 1127778, which seems unnecessary?
Assignee | ||
Updated•10 years ago
|
Blocks: fix-readability
Assignee | ||
Comment 1•10 years ago
|
||
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Attachment #8579067 -
Flags: review?(margaret.leibovic)
Assignee | ||
Updated•10 years ago
|
Iteration: --- → 39.2 - 23 Mar
Points: --- → 2
Flags: qe-verify-
Flags: in-testsuite+
Flags: firefox-backlog+
Comment 2•10 years ago
|
||
Comment on attachment 8579067 [details] [review]
Github PR
Nice, merged.
Attachment #8579067 -
Flags: review?(margaret.leibovic) → review+
Assignee | ||
Updated•10 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•