869 private links
A clever way to implement a htmx-like mechanism of substituting the content of a node with the response of a request.
It works like this. Have a hidden iframe whose onload callback sets the target node (specified by hash) with the iframe's body content. Then use an a
element to trigger the iframe load: <a target=_the_iframe href="/req-url#target-element">
.
TIL: a[target]
, iframe[hidden]
, contentWindow
, contentDocument
, <base target=X>
This thing amazes me when I saw it. Although I can roughly see how it may work, this still feels magical to me.
Then I realized, isn't this technique known as "inverse kinematics"?
An interesting made up story about supply chain attack on npm and javascript community.
A bunch of nice tricks to use browsers' web debugger console and console.log() faimilies.
More tricks shared in HN comments: https://news.ycombinator.com/item?id=29071700