Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your problem can be complicated because if there is a <code>div</code> that contains 2 words, plus another <code>&lt;p&gt;</code> inside the <code>div</code> with 200 words in it, then do you count the <code>div</code> having 202 words, or do you count the <code>p</code> having 200 words and therefore is the biggest?</p> <p>If there are 4 borders for <code>p</code>, then it can make sense to say it is <code>p</code> with 200 words. If there is no border, then it makes sense to say it is <code>div</code> with 202 words.</p> <p>You can try writing a function to traverse down a node, and if there is any <code>block</code> element with 4 borders, then don't include the word counts.</p> <p>Things can be more complicated if there are floated <code>div</code>s, which are set to <code>display:inline</code> to work around an IE 6 bug. Or if there are borders, but the color is the same as the background color of the containing <code>div</code>.</p> <p>If you don't care about the inside elements having borders, then one attempt can be just to look at the immediate children of body, and find out how many characters there are inside of it (sum of text under all descendants, probably using innerText or innerHTML and strip all the tags).</p> <p>You might also look into finding the biggest element with the biggest area (width x height), if you are looking for the content section, unless there is a long and narrow sidebar or ad section to the left and right, with the content area wide but really short.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload