Support <picture> element + some things relating to it

Suggestions and feature requests for the Pale Moon browser

Moderators: Indalecio, satrow

zcorpan

Re: Support <picture> element + some things relating to it

Postby zcorpan » Wed Sep 17, 2014 5:57 am

The arstechnica article does a terrible job at describing what actually happens. It was never true that browsers first downloaded everything and then started parsing. It is also not really true that images are downloaded before the markup is parsed.

What used to happen is that images are downloaded as soon as the HTML parses creates the <img> element (subject to download priorities of course). That could well be before the browser has completely fetched the CSS and hence, before it knows the layout.

What happens now is pretty much the same thing, except if there is a <script src> that blocks the HTML parser from continuing (it has to wait in case the script uses document.write), browsers now continue parsing the rest of the page with a lightweight speculative tokenizer in order to find further URLs to start fetching while the blocking script is downloaded. This includes images and it can happen before the browser knows the layout.

It was a requirement that responsive images do not break this optimization. Hence <picture>. If it was not important, you could use JS instead.

HTH

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 19442
Joined: Sun Aug 28, 2011 5:27 pm
Location: 58.5°N 15.5°E
Contact:

Re: Support <picture> element + some things relating to it

Postby Moonchild » Wed Sep 17, 2014 11:34 am

So, in other words, it's to counter bad web design. I don't see how that is going to be priority.
Improving Mozilla code: You know you're on the right track with code changes when you spend the majority of your time deleting code.
Image

zcorpan

Re: Support <picture> element + some things relating to it

Postby zcorpan » Thu Sep 18, 2014 7:29 am

Actually even if you don't use any blocking <script src>s, including the critical resources in the markup is still a good idea to let the browser properly prioritize its network resources.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 19442
Joined: Sun Aug 28, 2011 5:27 pm
Location: 58.5°N 15.5°E
Contact:

Re: Support <picture> element + some things relating to it

Postby Moonchild » Thu Sep 18, 2014 8:08 am

If web designers would actually follow the few simple design rules there are, this wouldn't be a problem to begin with. e.g. put CSS in the <head>, don't use blocking javascripts above the fold, load js asynchronously when you can, and use a lazy loading system on websites that have a very large content and lots of images. Simple rules, easy to follow, and no need for arbitrary elements. It's like this is an ongoing war between "camp scripting" and "camp markup". Of course the W3C is going to be solidly in "camp markup". We have advanced scripting, and modern web browsers who are exceedingly good at it, so why jump through hoops to avoid it?
Improving Mozilla code: You know you're on the right track with code changes when you spend the majority of your time deleting code.
Image


Return to “Suggestions/feature requests”

Who is online

Users browsing this forum: No registered users and 5 guests