Skip to content

Commit

Permalink
New rule: If a div has just one child, it should pass it to it's parent
Browse files Browse the repository at this point in the history
Should fix #9
  • Loading branch information
fb55 committed Jan 14, 2012
1 parent 225fda7 commit ec72bae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions readabilitySAX.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ Readability.prototype.onclosetag = function(tagName){
//clean headers
if (elem.attributeScore < 0 || elem.info.density > .33) return;
}
else if(tagName === "div" && elem.children.length === 1){
elem.parent.children.push(elem.children[0]);
return;
}
else if(this._settings.cleanConditionally && tagName in cleanConditionaly){
var p = elem.info.tagCount.p || 0,
contentLength = elem.info.textLength + elem.info.linkLength;
Expand Down

0 comments on commit ec72bae

Please sign in to comment.