Menu

I pressed select-all and copy on all 79 of our pages: 393 KB of words and 5.3 MB of markup
📰

I pressed select-all and copy on all 79 of our pages: 393 KB of words and 5.3 MB of markup

DEV Community: html·Daniel Pertu·2 days ago
#IMEGxhxB
#devto2#devto#dev#characters#clipboard
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.