3 ms·
> This can be agonizing while you wait for a much needed feature to roll out in all browsers, only to find out five years in the process one browser refuses the
by xg15 6y ago
> This can be agonizing while you wait for a much needed feature to roll out in all browsers, only to find out five years in the process one browser refuses the entire premise of the feature (RIP HTML Imports).
Slightly OT, but could someone explain to me why Mozilla was so adamantly against this feature? Allowing modular and dynamic HTML on the client without opening the pandora's box that is JavaScript seems like a clear value-add.
- jhardy54 6y agoMore info here: https://hacks.mozilla.org/2015/06/the-state-of-web-components/ https://hacks.mozilla.org/2015/06/the-state-of-web-component...
- zamadatix 6y agoSome small fraction of less than 1% consider "without opening the pandora's box that is JavaScript" a "clear value-add". The JS method already existed and worked for dynamic content as well. The latter part was Mozilla's reasoning. Also for a while they wanted to see how ES6 modules worked out and apply those lessens before committing to a certain import design for HTML. What they took back was the HTML imports proposal wasn't configurable enough and to make it that configurable you'd basically have the existing JS import method but fossilized and for fewer use cases. Looking at HTML imports it really breaks down into 2 types of use: - I want to import static HTML for the same origin - I want to import static HTML cross origin The former is relatively inefficient, the static HTML for the page should have been served when the client requested it not served as a request for the client to request it. The latter is odd (I'm sure there are use cases though) and wasn't considered worth implementing a new HTML feature for when the JS method gave better control of the import anyways. Mozilla's official musings: https://hacks.mozilla.org/2015/06/the-state-of-web-components/ https://hacks.mozilla.org/2015/06/the-state-of-web-component... https://hacks.mozilla.org/2014/12/mozilla-and-web-components/ https://hacks.mozilla.org/2014/12/mozilla-and-web-components...
- sthnblllII 6y agoWhy not just replace html entirely with a vm? All websites are obfuscated webasm programs that get a frame buffer to write pixels directly to the browser window. You want to be able to select text? Pray the website implements that "feature". Right click to show source? Ha. Good luck figuring out what the code is doing. Im describing taking Mozilla's logic to the extreme to show where it has led us.
- zamadatix 6y agoRequesting the content and injecting it into the document are both first party browser apis though. They didn't want for everyone to make a custom implementation they wanted for people to use the existing browser APIs. Just because something is done in JavaScript doesn't mean it's 3rd party, most of a browsers first party interfaces are in JS. What you've extrapolated is what would happen if each interface for funxtionality were left to 3rd parties, not what happens if the browser implements first party interfaces in JS instead of HTML. E.g. in your example of extrapolating it all the way it wouldn't be "everyone has to create a button and draw it to the screen" it'd be "to create a button you can create it in JS instead of HTML" And even then that's only assuming that because they made one choice on one thing the same choice would make as much sense for other things.
- xg15 6y agoMany site authors have an active interest in retaining the full control about what the user can do on their site, even against the interests of the user. So even if a functionality could in theory be delegated to the browser, I think there are real incentives for sites to implement it themselves if this gives them more control about user behavior. A website just being WASM + canvas would actually be in the interests of many site operators. I don't think the presence or absence of the "import HTML" feature would change a lot in this incentive structure, so this is more of a tangent. However, including the feature would at least have sites that don't want to go this way some support.
- xg15 6y ago> Some small fraction of less than 1% consider "without opening the pandora's box that is JavaScript" a "clear value-add". I think all the discussion and attention about trackers, paywalls, popups, etc paints a different picture. JS is turing-complete, which makes it extremely hard to in many cases impossible to predict what a particular JS program will do. It's much easier to verify that a HTML-only page won't do anything shady.
- xg15 6y agoThanks for the pointers. I found those pages before, but they didn't seem very understandable to me, as the reasoning seems to boil down to "the feature can be replicated in JS, so we won't need it", so I was wondering if there was more behind it.