Skip to content

Commit e9f2ee9

Browse files
committed
update the-fetchening.md
1 parent 7a0086f commit e9f2ee9

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

www/content/essays/the-fetchening.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ The biggest internal change is that `fetch()` will replace `XMLHttpRequest` as t
5454
won't actually have a huge effect on most usages of htmx _except_ that the events model will necessarily change due
5555
to the differences between `fetch()` and `XMLHttpRequest`.
5656

57-
### The Long National Nightmare of Implicit Attribute Inheritance Ends
57+
### Explicit Inheritance By Default
5858

59-
I feel that my biggest mistake in htmx 1.0 & 2.0 was making attribute inheritance _implicit_. I was inspired by CSS in
59+
I feel that the biggest mistake in htmx 1.0 & 2.0 was making attribute inheritance implicit. I was inspired by CSS in
6060
doing this, and the results have been roughly the same as CSS: powerful & maddening.
6161

62-
In htmx 4.0, attribute inheritance will be *explicit* rather than *implicit*, via the `:inherited` modifier:
62+
In htmx 4.0, attribute inheritance will be explicit by default rather than implicit. Explicit inheritance will
63+
be done via the `:inherited` modifier:
6364

6465
```html
6566
<div hx-target:inherited="#output">
@@ -72,11 +73,11 @@ In htmx 4.0, attribute inheritance will be *explicit* rather than *implicit*, vi
7273
Here the `hx-target` attribute is explicitly declared as `inherited` on the enclosing `div` and, if it wasn't, the
7374
`button` elements would not inherit the target from it.
7475

75-
This will be the most significant upgrade change to deal with for most htmx users.
76+
You will be able to revert to htmx 2.0 implicit inheritance behavior via a configuration variable.
7677

77-
### The Tyranny Of Locally Cached History Ends
78+
### No Locally Cached History
7879

79-
Another constant source of pain for both us and for htmx users is history support. htmx 2.0 stores history in local
80+
Another source of pain for both us and for htmx users is history support. htmx 2.0 stores history in local
8081
cache to make navigation faster. Unfortunately, snapshotting the DOM is often brittle because of third-party
8182
modifications, hidden state, etc. There is a terrible simplicity to the web 1.0 model of blowing everything away and
8283
starting over. There are also security concerns storing history information in session storage.
@@ -99,29 +100,27 @@ Most things.
99100
The [core](https://dl.acm.org/doi/10.1145/3648188.3675127) functionality of htmx will remain the same, `hx-get`, `hx-post`,
100101
`hx-target`, `hx-boost`, `hx-swap`, `hx-trigger`, etc.
101102

102-
Except for adding an `:inherited` modifier on a few attributes, many htmx projects will "just work" with htmx 4.
103+
With a few configuration tweaks, most htmx 2.x based applications should work with htmx 4.x.
103104

104105
These changes will make the long term maintenance & sustainability of the project much stronger. It will also take
105106
pressure off the 2.0 releases, which can now focus on stability rather than contemplating new features.
106107

107108
## Upgrading
108109

109-
That said, htmx 2.0 users _will_ face an upgrade project when moving to 4.0 in a way that they did not have to in moving
110+
htmx 2.0 users _will_ face an upgrade project when moving to 4.0 in a way that they did not have to in moving
110111
from 1.0 to 2.0.
111112

112-
I am sorry about that, and want to offer three things to address it:
113+
I am sorry about that, and want to offer two things to address it:
113114

114115
* htmx 2.0 (like htmx 1.0 & intercooler.js 1.0) will be supported _in perpetuity_, so there is absolutely _no_ pressure to
115116
upgrade your application: if htmx 2.0 is satisfying your hypermedia needs, you can stick with it.
116-
* We will create extensions that revert htmx 4 to htmx 2 behaviors as much as is feasible (e.g. Supporting the old implicit
117-
attribute inheritance model, at least)
118117
* We will roll htmx 4.0 out slowly, over a multi-year period. As with the htmx 1.0 -> 2.0 upgrade, there will be a long
119118
period where htmx 2.x is `latest` and htmx 4.x is `next`
120119

121120
## New Features
122121

123-
Of course, it isn't all bad. Beyond simplifying the implementation of htmx significantly, switching to fetch also gives
124-
us the opportunity to add some nice new features to htmx
122+
Beyond simplifying the implementation of htmx significantly, switching to fetch also gives us the opportunity to add
123+
some nice new features to htmx
125124

126125
### Streaming Responses & SSE in Core
127126

@@ -150,7 +149,7 @@ htmx 2.0 had already grown larger than I wanted.
150149
In 4.0, with the complexity savings we achieved by moving to `fetch()`, we can now comfortably fit a `morphInner` and
151150
`morphOuter` swap into core, thanks to the excellent work of Michael West.
152151

153-
### Explicit &lt;partial&gt; Tag Support
152+
### Explicit &lt;htmx-partial&gt; Tag Support
154153

155154
htmx has, since very early on, supported a concept of "Out-of-band" swaps: content that is removed from the main HTML
156155
response and swapped into the DOM elsewhere. I have always been a bit ambivalent about them, because they move away
@@ -169,7 +168,7 @@ filled by Out-of-band swaps:
169168
* A simple, id-based replacement
170169
* A more elaborate swap of partial content
171170

172-
Therefore, we are introducing the notion of `<partial>`s in htmx 4.0
171+
Therefore, we are introducing the notion of `<htmx-partial>`s in htmx 4.0
173172

174173
A partial element is, under the covers, a template element and, thus, can contain any sort of content you like. It
175174
specifies on itself all the standard htmx options regarding swapping, `hx-target` and `hx-swap` in particular, allowing

0 commit comments

Comments
 (0)