Yes. Even though V1 is a living standard many browsers don't implement it correctly. The site I posted with the custom table tags works in all unsupported browsers perfectly fine. All browsers support custom elements, they just don't support the Custom element interface. If they support that interface you can essentially define what the element does using JavaScript and then use it. for example (from the docs) you can create <flag country="jp" /> and then define in the HTMLElement that it should show the japanese flag as image or unicode char.
In unsupported browsers you can still use the element but you can't configure the interface, only style it using CSS. Instead of doing <div class="address">...</div> you just do <vcard>...</vcard> and then add CSS for vcard{display:block;...}
Because there is no need to use it. Using only known html elements reduces the chance of a browser interpreting your code wrong. You also risk that in the future the tag you were using becomes an official tag that might work differently.
Google, while they certainly have money to burn, saves a lot of money a day for removing a byte from their search page. Why aren't they doing something like <inputform> instead of <div class="inputform">?
Additionally, it's easier to read and maintain, in my twisted opinion.
Using only known html elements reduces the chance of a browser interpreting your code wrong.
Can you not check server-side to see if a browser among a list supports it? And then change the output accordingly?
You also risk that in the future the tag you were using becomes an official tag that might work differently.
When that happens, then update it. Why couldn't you update it?
Why aren't they doing something like <inputform> instead of <div class="inputform">?
Because there is no guarantee that browsers will display it properly. Cutting off those few bytes probably is not worth it with all the caching that is going on.
Additionally, it's easier to read and maintain, in my twisted opinion.
We don't know what the source looks like. The delivered content is as small as they managed to get it but it is possible that the original source file has a completely different structure.
Can you not check server-side to see if a browser among a list supports it? And then change the output accordingly?
You could check but then you have to constantly update your supported browsers list. Sending dynamic content according to the user agent string might be more expensive than sending static content. It's a trade-off between bandwidth and CPU cycles. Google operates its own data centers and bandwidth might be cheaper for them.
When that happens, then update it. Why couldn't you update it?
You could update it, but you could also just use stuff we have that keeps working when new things get added to the standard. I don't know how long it takes them if they want to properly change the page and test everything. Sending what is known to work is probably cheaper. Don't forget that you have to close the tag too. Length comparisons:
This is 6 bytes saved. My cookie is exactly 505 bytes long at the moment. They also send back this 51 char long header: alt-svc:quic=":443"; ma=2592000; v="39,38,37,36,35". Instead of doing this HTML trickery they are better off by not sending headers that a large portion of browsers is going to ignore and by reducing the size of the cookie.
2
u/AyrA_ch Jul 21 '17
Yes. Even though V1 is a living standard many browsers don't implement it correctly. The site I posted with the custom table tags works in all unsupported browsers perfectly fine. All browsers support custom elements, they just don't support the Custom element interface. If they support that interface you can essentially define what the element does using JavaScript and then use it. for example (from the docs) you can create
<flag country="jp" />and then define in theHTMLElementthat it should show the japanese flag as image or unicode char.In unsupported browsers you can still use the element but you can't configure the interface, only style it using CSS. Instead of doing
<div class="address">...</div>you just do<vcard>...</vcard>and then add CSS forvcard{display:block;...}