Readers quote sites. They select a paragraph, or the whole page, and paste it into an email, a doc, a Slack message, a spreadsheet. I had never once looked at what our site puts on the clipboard when they do, so I measured it on all 79 pages of our site .
The instrument is four lines in the page:
const sel = getSelection ( ) ; const range = document . createRange ( ) ; range . selectNodeContents ( document . body ) ; sel . addRange ( range ) ; const text = sel . toString ( ) ; // the text/plain flavour const html = ( ( ) => { const d = document . createElement ( "div" ) ; d . appendChild ( range . cloneContents ( ) ) ; return d . innerHTML ; } ) ( ) ; // text/html
Enter fullscreen mode
Exit fullscreen mode
The two flavours
across 79 pages characters
text/plain 392,583
text/html 5,326,804
13.6 times more markup than words. On /faq alone it is 6,144 characters of text against 73,348 of HTML.…