Live data from Hacker News

Why can't HTML alone do includes?

frontendmasters.com

121–130 of 367 posts

Re: Why can't HTML alone do includes?

#121
post #17

This was the rabbit hole that I started down in the late 90s and still haven’t come out of. I was the webmaster of the Analog Science Fiction website and I was building tons of static pages, each with the same header and side bar. It drove me nuts. So I did some research and found out about Apache server side includes. Woo hoo! Keeping it DRY (before I knew DRY was a thing). Yeah, we’ve been solving this over and ove…

> Iframes don’t expand to fit content Actually, that was part of the original plan - https://caniuse.com/iframe-seamless

I used the seamless attribute extensively in the past, it still doesn't work the way GP intended, which is to fit in the layout flow, for example to take the full width provided by the parent, or automatically resize the height (the pain of years of my career)

It worked rather like a reverse shadow DOM, allowing CSS from the parent document to leak into the child, removing borders and other visual chrome that would make it distinguishable from the host, except you still had to use fixed CSS layouts and resize it with JS.

Re: Why can't HTML alone do includes?

#123

The feature proposal was called HTML Imports [1], created as part of the Web Components effort. > HTML Imports are a way to include and reuse HTML documents in other HTML documents There were plans for tag support and everything. If I remember correctly, Google implemented the proposed spec in Blink but everyone else balked for various reasons. Mozilla was concerned with the complexity of the implementation and its s…

https://caniuse.com/imports says FF even had it as a config flag

Re: Why can't HTML alone do includes?

#126

Earlier quoted context omitted.

What's the ML in HTML stand for? I think that's probably the crux of the argument. Are we gonna evolve it past its name?

If the issue is that "include" somehow makes it sound like it's not markup, the solution seems obvious. Just use the src attribute on other tags: , , , etc. Or create a new tag that's a noun like fragment, page, document, subdoc or something. Surely that's no less markup than svg, img, script, video, iframe, and what not.

[deleted]

Re: Why can't HTML alone do includes?

#128

The feature proposal was called HTML Imports [1], created as part of the Web Components effort. > HTML Imports are a way to include and reuse HTML documents in other HTML documents There were plans for tag support and everything. If I remember correctly, Google implemented the proposed spec in Blink but everyone else balked for various reasons. Mozilla was concerned with the complexity of the implementation and its s…

Frames essentially could do html import

Re: Why can't HTML alone do includes?

#129
So glad I decided early in my career to not do webpages. Look how much discussion this minor feature has generated. I did make infra tools that outputted basic html, get post cgi type of stuff. What's funny is this stuff was deployed right before AWS was launched and a year later the on prem infra was sold and the warehouse services were moved to the cloud.

Re: Why can't HTML alone do includes?

#130
At least some of the blame here is the bias towards HTML being something that is dynamic code generated, as opposed to something that is statically handwritten by many people.

There are features that would be good for the latter that have been removed. For example, if you need to embed HTML code examples, you can use the tag, which makes it so you don't need to encode escapes. Sadly, the HTML5 spec is trying to obsolete the tag even though it's the only way to make this work. All browsers seem to be supporting it anyways, but once it is removed you will always have to encode the examples.

HTML spec developers should be more careful to consider people hand coding HTML when designing specifications, or at least decisions that will require JavaScript to accomplish something it probably shouldn't be needed for.

Post reply on HN