bdcravens an hour ago

This is actually a very nice primer on how to build custom elements even if you don't use Rails.

phoronixrly an hour ago

Great article, however using raw custom elements goes IMO against Rails' spirit, as it is way too low level, and requires lots of boilerplate to get working.

Stimulus is in the sweet spot for that. Both lean (as opposed to bloated), and not too low level, so that using it does not lead to verbose code. It is one of the very few JS frameworks that IMO do not contribute to JS proliferation, but actually work to reduce the amount of JS written.

usernamed7 4 hours ago

FWIW you don't even need to define custom elements to use them: https://html3000.dev/

  • yoz-y 2 hours ago

    This website violates the rule that all custom elements must have a dash in the tag name.

    • rsstack an hour ago

      https://html.spec.whatwg.org/multipage/custom-elements.html#...

      > This is used for namespacing and to ensure forward compatibility (since no elements will be added to HTML, SVG, or MathML with hyphen-containing local names going forward).

      So things that work today without a dash might break in the future if <badge>, for example, becomes a standard HTML element.

  • cgarvis 4 hours ago

    never knew you could do css selectors on custom elements! does seem like syntactical sugar over classes. I do like the current trend with tailwind: style with markup using smaller components. But maybe there is something here with so many components being just styles...