ProQuestDocuments 2024 05 23
ProQuestDocuments 2024 05 23
Tyson, Matthew
RESUMEN (ENGLISH)
The user update in HTMX hx-target="this" hx-swap="outerHTML"> First Name: Joe Last Name: Blow Email:
[email protected] hx-get="/contact/1/edit" class="btn btn-primary"> Click To Edit hx-put="/contact/1" hx-target="this"
hx-swap="outerHTML"> First Name type="text" name="firstName" value="Joe"> class="form-group"> Last Name
type="text" name="lastName" value="Blow"> class="form-group"> Email Address type="email" name="email"
value="[email protected]"> class="btn">Submit class="btn" hx-get="/contact/1">Cancel If you look at the markup in
Listing 1, it is easy to see what is happening: the hx-swap property provides the HTML for the div before it is edited,
and outerHTML tells the framework how it relates to the dynamic content inside. The answer is easy: it uses server-
side rendering of the HTML for the edit markup and abstracts the form marshaling into the framework. To start, the
existing to-do items are output from Express with the command: res.render('index', { todos: filteredTodos, filter,
itemsLeft: getItemsLeft() }); This command uses the in-memory collection of to-dos and renders them with a Pug
template that is in the typical format, except it includes the special hx- properties that drive HTMX interactions. Tips
and best practices from developers * Python moves to remove the GIL and boost concurrency * 7 reasons Java is
still great * The open source licensing war is over Crédito: Matthew Tyson
TEXTO COMPLETO
HTMX lets you use an extended HTML syntax instead of JavaScript to achieve interactivity. HTMX gives you HTTP
interactions directly in the markup, and it supports many other interactive needs without resorting to JavaScript. It’s
an interesting idea that could end up influencing the way web front-ends work. Let’s see how HTMX is used and
what makes it so compelling.
What is HTMX?
HTMX has been around for some time, but it has been a bit of a sleeper project. Its recent acceptance into the
GitHub Accelerator may change all that. The basic idea is to take common use cases that require boilerplate
JavaScript-and-HTML interactions and just use an HTML syntax, without the JavaScript. Many interactions become
declarative with HTMX.
This already sounds promising, doesn’t it? Every web developer knows there are many common boilerplate cases.
Carson Gross, the creator of HTMX, says he’s hoping to "complete HTML as a hypertext, increasing its
expressiveness enough to make it a competitive alternative for more advanced, modern web applications.”
To get a quick taste, see this HTMX demo. Basically, we click on a button to enable editing the fields on the user
object. The data is actually PUT into a back-end endpoint. You can see the demo in Figure 1—notice the network
interaction in the bottom frame after you click Show.
[Image Omited]
Normally, this all would require JavaScript of some kind, no matter what framework you were using. HTMX turns the
interaction into two chunks of markup: one for the display UI and one for the edit UI, as shown in Listing 1.
Listing 1. The user update in HTMX
hx-target="this" hx-swap="outerHTML">
First Name: Joe
Last Name: Blow
Email: [email protected]
DETALLES
Materia: Electronic mail; Best practice; Artificial intelligence; Syntax; HyperText Markup
Language; JavaScript; Software; Developers; Software industry; Java
Término de indexación de Asunto: Artificial intelligence Developers Software industry; Sector: 23721 : Land
negocios: Subdivision 51321 : Software Publishers
Editorial: Foundry
Base de datos: Advanced Technologies &Aerospace Collection; ProQuest One Academic; ProQuest
One Business
Copyright de la base de datos 2024 ProQuest LLC. Reservados todos los derechos.