ZegnatSeb[d]: possible problem: if you make the <script> in your head async, it may not have loaded yet when the browser gets to the <script> at the end of your body where you try and call the functions. So the functions will not be defined yet at that point.
ZegnatIf you do keep it blocking, you probably did not need the DOMContentLoaded at all, because you are triggering the code at the end of body when the elements are already part of the DOM :)
chenghiz_, voxpelli, Allie_ and willnorris joined the channel
@aswath↩️ He better define what he means by voip. I suspect he is restricting his focus to SIP, thattoo interworking w PSTN, including crossbar. IfI restrict myself to full IP then it is solvedw WebRTC and Indieauth.#EnThinnai (twitter.com/_/status/1458822903768793090)
schmudde, Aksel and akevinhuang2 joined the channel
Zegnat[tantek]1: re https://tantek.com/t5Fh2 - I do wonder if for performance <script async> in <head> will win out as browsers can apply their own scheduling for downloading external scripts in the most optimal way. Maybe paralel with CSS etc. While the elements at the end of the page will be encountered later by the parser. I am just not sure how I would do a testcase for that.
Loqi[Tantek Çelik] inspired by @csswizardry @btconf, tried ct.css on my homepage (had to disable HTTP CSP), & only 1 green box!
No <script> in <head>, no problem.
If you support Progressive Enhancement (all sites should), scripts can go at end of body, right before <...
[tantek]1good questions Zegnat. I suppose what I'm signaling to the browser by putting my scripts at the end is that I *really* don't want *any* bandwidth/CPU wasted on anything script related that could *possibly* be used for faster handling of rendering / first interaction with the page.
[tantek]1like even if it's just a "few hundred milliseconds" of difference, it's worth it, or even if it's only noticeable on "slower" connections or "older" devices
ZegnatI am just wondering if that would already be done by the async flag, as browsers should not stop rendering for those. But again, would need a solid test case or a browser engineer who knows how their fetching priorities work to weigh in.
[tantek]1say you have images later on in the page, like photos. an async script *might* start downloading (and waste bandwidth) before the image can start downloading
[tantek]1defer could work. I suppose the "scripts right before </body>" technique doesn't need explicit browser support for "defer" so might work on more (older?) devices?
ZegnatThough for some of those we are talking about 10+ year old browsers? I am not sure how many of those are actually likely to visit my site. https://caniuse.com/script-defer
ZegnatOpera Mini is special anyway, as you need to know what their server side rendering client supports, right? As it will never run JS on-device, at least not when I last used it
Loqiprogressive enhancement is the web development practice of building web pages, sites, apps so they are at least readable, and preferably allow for most if not all interactions, from any kind of browser, and optionally take advantage of additional capabilities (like various CSS & JS features) when available https://indieweb.org/progressive_enhancement