|
|
|
| It had breadcrumbs back in 2004 (e.g. those neat "valid XHTML 1.1" badges from W3C back when badges on your website were cool, and e.g. W3 Schools actually put it above javascript[0]. XHTML was supposed to be the next big thing). These days it seems that browser vendors just don't like it for whatever reason (tinfoil hat on: because almost all of them benefit from javascript-based spyware, and so prefer a world where even static pages require javascript to be enabled to show anything), and so documentation acts like it is some legacy thing instead of what it is: a perfect fit for the 99% of websites that need some templates and don't have much dynamic interaction.
Other cool web tech that should have "won": XForms[1]. Imagine if HTML forms had things like declarative data-binding (with XPath expressions! Imagine jq built directly into the browser 20 years ago and usable by forms) and types/constraints/validation built right in. This would be 1000x more useful for your average web dev than something like USB or GPU support or Wasm. You'd be able to make complex interactive forms in much the same way that you do a spreadsheet. [0] https://web.archive.org/web/20040727061732/http://www.w3scho... |
|
| XSLT 3.0 can be directed to output HTML5 [0]. However, browsers only implement XSLT 1.0, and as far as I am aware there is no open-source XSLT 3.0 implementation.
Still, it's possible with XSLT 1.0 to produce documents in the common subset of XML and HTML5 ("XHTML5"). It can't produce the usual at the top of the document, but it can produce the alternative . On the input side, every XSLT version only accepts valid XML, as far as I am aware. [0] https://www.w3.org/TR/xslt-xquery-serialization-30/#html-out... |
|
| I think whether or not this makes sense on the client-side is up for debate.
Alternatively, though, SVGs in `` |
|
| I may be completely off and/or misremembering, but isn't this what |
|
| I like to use sprite files for conditional styling of icons, because using separate file for each state creates a visible delay on state changes, which doesn't look great.
You can make them with |
|
| Oh man, you're right, I didn't realize they worked this way. This basically means there is no compromise at all, I'm going to update the post. Thanks! |
|
| Boxy SVG editor comes with built-in support for creation and editing of SVG icon sprites.
You can play with a sample SVG sprite on https://boxy-svg.com/#demo-symbols. Individual icons are shown under "Defs Panel -> Symbols". To edit an icon just double-click its thumbnail. To make part of an icon recolorable, select that part and then click "Fill Panel -> Paint -> Type -> Inherit". You could then create separate symbols which contain a recolored instance of the original symbol. The underlying markup will look something like this:
Finally, use a fragment identifier to show a specific icon in HTML: |
|
| Another option would be to including SVG files from SVG elements, though the whole thing is a bit cursed. I'm not 100% sure how it plays with CSS and caching
Example: svg poster - includes svg diagrams - that include svg maps (maps are generated programmatically) https://kxygk.github.io/imergination/ Though.. if you open the SVG itself (in a separate window/tab) most elements refuse to display for "security" https://raw.githubusercontent.com/wiki/kxygk/imergination/ag... It's honestly an unreliable format for anything that's mildly complex.. this poster will render differently in different browsers (and inkscape) and can't be turned into a PDF consistently. It's a mess |
|
| There's an important caveat with this: It does not work cross-origin, and there is no way to make it work except for including some JS like svg4everybody. CORS does not apply. |
|
| Really interesting, am a big fan of the utility that SVG's provide, an undersung hero of the web imo. One thing I've always particularly liked is you can wrap elements inside of an |
|
| > but might waste bandwidth if used for SVGs used often, like a logo or icon.
You can put SVGs into a . I've used this for "site and social icons" to great effect. |
|
| Doesn't the tag tick all three boxes?
(the OP does mention the tag in the final notes but only for in-document fragment references, not for remote URLs) |
|
| I went the rabbit hole of exploring SVG "decimal precision-related" glitches in browser implementations and to my grief I must confirm that there really are blatant cross-browser issues. It's fact that my tests went a bit over-the-top with dimensions -- who would make 1e9 or 1e-9 wide viewBox in real world anyway? -- but since refraining from doing so is not discouraged in the specs, one would expect it would scale (pun intended) at least few orders of magnitude. The results for my particular testcase showed that "safe" range was only between 2e3 and 2e5: [1].
https://myfonj.github.io/tst/SVG-decimal-precision-results.h... |
|
| Do they? I thought this is more issue on the source code side, rather than implementation: this is actually my pet-peeves, that most SVG *authoring tools* never output circular arcs and always use cubic béziers approximations instead. So we nearly ever see real circles or their segments, even though authors use them in their designs all the time.
// Coincidentally played with this test yesterday: https://myfonj.github.io/sandbox.html#%3C!doctype%20html%3E%... |
|
| Svg can, and often will, include (embed) raster images.
But even when not: in practice an SVG will have hundreds or thousands of XML elements (nodes) to draw rather simple-looking shapes even. |
|
| There's a diagram on this page?
Holy shit there is. When my dark theme is enabled, the diagram is black on black. Amazing. (all that's visible is the emoji!) |
|
| I can't replicate on mine. If this is due to nested styles, I think you are behind on your software updates :). But also, maybe I need to hold off a bit longer before moving to nested styles. |
Can't you say that about anything in HTML? Like, imagine you had a huge `
` tag that contained a bunch of stuff, but it's essentially the same (except for, like, the title) for all documents. Don't you wanna do this? Where the `>>` is a pretend bit of HTML that makes the browser fetch that from somewhere else. A preprocessor, more or less.I realize this is what templating languages are for, but if this happened on the HTML layer, the browser could do way better caching.