4 ms·
> <user-avatar> > <img src="https://example.com/path/to/img.jpg https://example.com/path/to/img.jpg" alt="..." /> > </user-avatar> I thought the standard wa
by sesm 3y ago
> <user-avatar>
> <img src="https://example.com/path/to/img.jpg https://example.com/path/to/img.jpg" alt="..." />
> </user-avatar>
I thought the standard way to do it is:
<img is="user-avatar" src="https://example.com/path/to/img.jpg https://example.com/path/to/img.jpg" alt="..." />
- joestrouth1 3y agoThat is one way to do it, provided `user-avatar` extends HTMLImageElement and not the more generic HTMLElement. Extending built-ins and using the `is` attribute is not supported in Safari however and last I checked they were firmly opposed to it. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is https://developer.mozilla.org/en-US/docs/Web/HTML/Global_att...
- yuretz 3y agoThere is a polyfill for customiziing built-ins on Safari. https://github.com/ungap/custom-elements https://github.com/ungap/custom-elements
- earthboundkid 3y agohttps://caniuse.com/mdn-api_customelementregistry_builtin_element_support https://caniuse.com/mdn-api_customelementregistry_builtin_el...
- deleted 3y ago[deleted]
- jjcm 3y agoThey're different things, though with an extremely simple component they might achieve a relatively similar goal. The downside of `is` is that you can only specify a single element to map to the component. An example of why you'd need to take the slotted approach is if you had something like this: <user-avatar> <img slot="image" src="..."> <div slot="name">Bob Bobson</div> </user-avatar>
- randyrand 3y agoThere’s almost no standard way to do anything when it comes to html style.