Repository with sources and generator of https://larlet.fr/david/ https://larlet.fr/david/
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

index.md 1.6KB

1234567891011121314
  1. title: Stimulus, JS and HTML
  2. lang: en
  3. > Stimulus is concerned with manipulating this existing HTML document. Sometimes that means adding a CSS class that hides an element or animates it or highlights it. Sometimes it means rearranging elements in groupings. Sometimes it means manipulating the content of an element, like when we transform UTC times that can be cached into local times that can be displayed.
  4. >
  5. > […]
  6. >
  7. > This makes Stimulus very different from the majority of contemporary JavaScript frameworks. Almost all are focused on turning JSON into DOM elements via a template language of some sort. Many use these frameworks to birth an empty page, which is then filled exclusively with elements created through this JSON-to-template rendering.
  8. >
  9. > Stimulus also differs on the question of state. Most frameworks have ways of maintaining state within JavaScript objects, and then render HTML based on that state. Stimulus is the exact opposite. State is stored in the HTML, so that controllers can be discarded between page changes, but still reinitialize as they were when the cached HTML appears again.
  10. >
  11. > <cite>*[The Origin of Stimulus](https://github.com/stimulusjs/stimulus/blob/master/ORIGIN.md)* ([cache](/david/cache/8c3ee729edc11c25b31a3cec6d59e7ae/))</cite>
  12. A different paradigm, an old one actually, revisited. I’m more inclined to use that kind of approach *given my usual needs*. And if it gets bigger, it’s probably not my fish and I’m happy with that. It looks more robust by default and does not serve a blank page [for whatever valid reason](/david/blog/2017/without-javascript/).