[HN Gopher] Why Not document.write()?
___________________________________________________________________
Why Not document.write()?
Author : fagnerbrack
Score : 12 points
Date : 2023-04-01 09:58 UTC (13 hours ago)
(HTM) web link (csswizardry.com)
(TXT) w3m dump (csswizardry.com)
| theendisney wrote:
| this seems fantastic
|
| if(condition) document.write('<!--')
|
| How else accomplish that?
| zffr wrote:
| You can use JS to set `display: none` on the relevant HTML
| elements
| johannes1234321 wrote:
| The elements then still appear in the DOM and may be affected
| by DOM manipulation etc.
| dmix wrote:
| > The whole reason I'm writing this post is that I have a client
| at the moment who is using document.write() late in the <head>.
| As we now know, this pushes both the fetch and the execution on
| the main thread.
|
| Is there any tools that you can use to help detect stuff like
| this? In order to do performance optmizations
| metadat wrote:
| Google Page Speed gives actionable insights into page loading
| bottlenecks.
|
| https://pagespeed.web.dev/
|
| Off-topic: Apparently the URL flavor this month is infected
| with the .dev TLD proliferation g-corp agenda (as is golang.org
| -> golang.dev). Do cool URLs ever really change?
| dplgk wrote:
| Lighthouse in Chrome dev tools
| metadat wrote:
| This performance conundrum reeks of excessive complexity. I've
| warmed up to Javascript over the past 15 years, but forcing
| website authors to concern themselves with such details becomes
| less and less appealing and seems ridiculous. I hope the future
| of HTML+JS will involve to a better way.
|
| I thoroughly enjoyed the spiritual essence and relative purity of
| HyperCard at the time in the 1990s.
|
| Edit: @ly: Apologies, I should have been more specific and clear.
| Referring to the complexity matrix in terms of what may or may
| not cause page rendering to block at any given moment. Complexity
| in this location all but ensures you will make a suboptimal
| decision during development unless you run every release
| candidate through Google Page Speed.
| ly wrote:
| Nobody is forcing anyone not to use Document.write(). The
| author has voluntarily run a test using Lighthouse on their
| website, which gives this suggestion as it is not conforming to
| the Lighthouse "Best Practices".
| [deleted]
___________________________________________________________________
(page generated 2023-04-01 23:02 UTC)