summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/readability-0.1.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/readability-0.1.js b/js/readability-0.1.js
index 9397687..6c255e6 100755
--- a/js/readability-0.1.js
+++ b/js/readability-0.1.js
@@ -92,11 +92,9 @@ function grabArticle() {
*/
}
- allNodes = document.getElementsByTagName("*");
- for(nodeIndex = 0; nodeIndex < allNodes.length; nodeIndex++)
+ /* Assignment from index for performance. See http://www.peachpit.com/articles/article.aspx?p=31567&seqNum=5 */
+ for(nodeIndex = 0; (node = document.getElementsByTagName('*')[nodeIndex]); nodeIndex++)
{
- node = allNodes[nodeIndex];
-
if(typeof node.readability != 'undefined')
{
dbg('Found a node with a content score of ' + node.readability.contentScore);
@@ -158,6 +156,9 @@ function cleanStyles( e ) {
e = e || document;
var cur = e.firstChild;
+ // Remove any root styles
+ e.removeAttribute('style');
+
// Go until there are no more child nodes
while ( cur != null ) {
if ( cur.nodeType == 1 ) {