Skip to content

Instantly share code, notes, and snippets.

@bborn
bborn / test.html
Last active February 7, 2024 18:00
<html>
<title>Test</title>
<body>
This is a test.
<script>
// Create a new div
const div = document.createElement('div');
// Set the div's text content to 'foo'
import {Controller} from "@hotwired/stimulus"
/*
* PermanentAttribute Controller
*
* This prevents Turbo morphing from updating certain attributes on an element.
* It is especially useful if you have changed a class on the browser in response
* to a UI event without sending this change to the server. The server does not
* know about this change and so will send the browser the original class on morphing,
* thereby clearing the state introduced by the original UI event.