whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.19k stars 2.71k forks source link

"Link type "icon"" should be able to point to an <svg> or <canvas> #661

Open zcorpan opened 8 years ago

zcorpan commented 8 years ago

https://html.spec.whatwg.org/multipage/semantics.html#rel-icon

Link type "icon"

Some sites use a canvas and then update the <link rel=icon>'s href to the canvas's toDataURL(), e.g. to implement an animated icon or to show how many unread messages there are.

I discussed with @fsoder in the context of supporting SVG favicons in Chromium and it seems like it would be better to be able to link to an in-document svg or canvas element directly for those use cases. Round-tripping via a data: URL is basically unnecessary overhead in principle.

domenic commented 8 years ago

So the idea would be <link rel="icon" href="#foo"> where elsewhere in the document there's <canvas id="foo">?

zcorpan commented 8 years ago

Exactly so, yes.

tabatkins commented 8 years ago

Would this be a special-case thing just for icons, or should it be supported for all image-loading paths? What about external refs?

annevk commented 8 years ago

Maybe it's better to make this an API. srcObject (or hrefObject I guess). Otherwise we start special casing URLs in weird ways.