Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is a no JS website possible with this if put thought some preprocessor (Speculation) #14

Closed
mofosyne opened this issue Feb 21, 2024 · 5 comments

Comments

@mofosyne
Copy link

mofosyne commented Feb 21, 2024

If I understand the snippet correctly, this search and replaces the doc and replace specific sections with a specially formatted iframe.

If that's the case, then in theory it could be possible to add a script to this htmz for static website generators to add some dynamic capabilities to their site (but without having to add JS code to it).

Application for this technique could be for torsites that should really not have javascript enabled.


You still want to keep the snippet as it makes things easier without having to integrate a preprocessor. But basically this would be an extra optional script in this repo that developers can optionally call. It would read a html input and scan for a htmlz snippet (to indicate it is being used) and then do the search and replace of required tags with an iframe) before outputting to stdio

@jmcudd
Copy link

jmcudd commented Feb 21, 2024

The technique used by htmz is likened to the technique used by htmx. Its function and use cases have been extensively documented and written about on htmx.org. I recommend you go read about hypermedia and HATEOAS on htmx.org Essays. Htmz is merely a ultra lightweight implementation without any bells or whistles.

@Kalabasa
Copy link
Owner

I don't think noJS is possible. But what you're describing as a preprocessor is similar to one of the examples (as a Cloudflare worker): https://github.com/Kalabasa/htmz/blob/eda6e50296b4309665a9792e6c6a8c1d682ec1ce/examples/cf_clean_target_tabs/worker.js

Otherwise, I think you're looking for a HTML templating system?

@Jaculabilis
Copy link

In theory, if all you need to do is apply a selector and replace HTML, the browser should be able to do it without going through the JS engine. The only reason htmz needs JS is because the HTML specification doesn't have a keyword for target= that behaves the way htmz does, so it implements that in JS. With enough support, you could probably get that behavior into the HTML specification, and then browsers with JS disabled or lacking a JS engine entirely would have interactive web pages the htmz way.

@mofosyne
Copy link
Author

mofosyne commented Feb 23, 2024

Then perhaps this ticket should be more "How do we get target= behavior updated in the HTML specification"?

Is this where we should post the proposal to?

If so then how do we exactly describe the required changes?

https://github.com/whatwg/html

@Kalabasa
Copy link
Owner

Yes, it would be whatwg/html.

I think there are two slightly different things being discussed in this thread:

  1. On load, automatically load external HTML into a specified element
  2. On click, load external HTML into a specified element

htmz implements #2 only.

#1 is being proposed in whatwg/html#2791.

A separate proposal is probably better for #2 because it would be simpler. It wouldn't have to deal with render blocking and circular dependency issues as in #1.

Converting this into a Discussion.

Repository owner locked and limited conversation to collaborators Feb 24, 2024
@Kalabasa Kalabasa converted this issue into discussion #21 Feb 24, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants