#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
#Loqizegnat has 14 karma in this channel over the last year (33 in all channels)
voxpelli, squarepants and schmudde 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
#GWGZegnat: Do you want to try to iterate on ticket auth further?
#ZegnatI am not quiet sure what more I need on Ticket Auth just yet
edburns[d], kogepan, schmudde and sebsel 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]1because none of the rendering nor interactions *depend* on script.
#aaronpki think that's a really good first step beyond reordering stuff in the head
#[tantek]1and quickly displaying content and responding to user interaction demands is the top priority of a page, not script
#[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
#[tantek]1making slower connections / older devices feel faster or ideally feel *fast* no caveats is worth it
#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.
#ZegnatI too like putting my <script> at </body>. Just today that I thought of if that might be suboptimal or not, haha
#[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
#ZegnatTrue, yes, in that case you would want the <script> after those <img>. Good case!
#[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
#ZegnatA versio of defer shipped in Firefox 3.5 in 2009, according to caniuse
#[tantek]1I may very well have organized my scripts into that part of my home page ~10 years ago
#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
#ZegnatSo if you know you have users in Opera Mini markets, you need a whole separate testing flow
#[tantek]1or you do Progressive Enhancement and assume the Opera Mini users may never see your scripts
#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