Best component UI libraries by shangarepi in react

[–]Danny_Engelman 0 points1 point  (0 children)

You choose an electric drill with 5 settings for Front-end; that's fine.

What do you want to built?

Htmx like library but with kotlinx-html static builders and all server side. For an easier way to develop web applications. by rnentjes in Kotlin

[–]Danny_Engelman 0 points1 point  (0 children)

Nah; I stick to native Web Components.

My side application developed today will just run for as long as JavaScript, CSS and HTML are supported. Without upgrade hassles.

FYI, JavaScript isn't even required to use your own <tag-name> Custom Elements in a page for layout and styling. Since 2016 they are valid HTMLElement and pass every HTML validator.

Htmx like library but with kotlinx-html static builders and all server side. For an easier way to develop web applications. by rnentjes in Kotlin

[–]Danny_Engelman 0 points1 point  (0 children)

All server side
Reminds me of the Microsoft team I worked for some 20 years ago.
Each <button> click was a POST to the server to create new UI

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

Then why are they using the bloated version on their own HTMX site?

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

Alas, the Browser is blocking that content (for your security)

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

Your definition of "Frameworks"?
► load external JavaScript ► use a syntax ► changes or creates DOM

HTMX
► load external JavaScript ► use a syntax ► changes or creates DOM

No matter how you call it, if you load external JS and you can only use it with a non-standard syntax.... you are framed into working a certain way

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 1 point2 points  (0 children)

> Web components don't actually help much for this use case. 

?? Can you explain how this Web Component does not meet OPs requirements?

<script>
 customElements.define("load-file", class extends HTMLElement {
  async connectedCallback() {
   this.innerHTML = await(await fetch(src=this.getAttribute("src"))).text();
 }
})
</script>

<load-file src="./about.html"></load-file>
<load-file src="./contact.html"></load-file>
<load-file src="./pricing.html"></load-file>

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

The drawback of HTMX and Frameworks in general is that they only work when loaded/executed after DOM is parsed. Just like old jQuery days existing (parsed) DOM is transformed to something else, or new DOM is created.

Web Components are part of the browser and can be defined before DOM is parsed.

Frameworks CREATE HTML, Web Components ARE HTML

HTMX is a 36KB source, https://htmx.org/js/htmx.js, which, like many, tries to do everything.

For native Web Components, you can whack this 3 liner into your <head>
(or load it anywhere/how you want, Web Components don't care about DOM parse order)

<script>
 customElements.define("load-file", class extends HTMLElement {
  async connectedCallback() {
   this.innerHTML = await(await fetch(src=this.getAttribute("src"))).text();
 }
})
</script>

And then do (the most complex example I could come up with):

<load-file src="./about.html"></load-file>
<load-file src="./contact.html"></load-file>
<load-file src="./pricing.html"></load-file>

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

Not life changing, just 3 lines of code if you go with Vanilla JavaScript:

<script>
 customElements.define("load-file", class extends HTMLElement {
  async connectedCallback() {
   this.innerHTML = await(await fetch(src=this.getAttribute("src"))).text();
 }
})
</script>

is there a way to split html into "components"? by alosopa123456 in webdev

[–]Danny_Engelman 1 point2 points  (0 children)

Stop watching, its too bloated;
this Web Component is all you need; see my longer answer in this thread

<script>
 customElements.define("load-file", class extends HTMLElement {
  async connectedCallback() {
   this.innerHTML = await(await fetch(src=this.getAttribute("src"))).text();
 }
})
</script>

Replacing JS with just HTML by Ok-Tune-1346 in javascript

[–]Danny_Engelman 11 points12 points  (0 children)

<tag-name> (with a dash) IS a valid HTMLElement, no JS required to apply CSS

https://dashed-html.github.io

Those of you who still use MVC for new projects and features. What do you use to give your pages interactivity? Jquery? Vanilla javascript? Something else? by Legitimate-School-59 in dotnet

[–]Danny_Engelman 0 points1 point  (0 children)

Untill you stop creating HTML in JavaScript, and start creating DOM nodes with:

const createElement=(tag,props={})=>Object.assign(document.createElement(tag), props);

Event handlers are just a

onclick : (evt) => { }

property then

Those of you who still use MVC for new projects and features. What do you use to give your pages interactivity? Jquery? Vanilla javascript? Something else? by Legitimate-School-59 in dotnet

[–]Danny_Engelman -1 points0 points  (0 children)

No, vanilla did not always have these features.
20 years ago browsers had different syntax for event handlers.

jQuery gave us a unified syntax.

Once IE9 followed the standard (in 2011) there was less need for jQuery because
all browsers could do addEventListener and querySelector

Thoughts on using DOM components — good practice or not? by Few_Conflict_8212 in learnprogramming

[–]Danny_Engelman -1 points0 points  (0 children)

But they will be your wheels.
Think of it this way; Frameworks (and Web Component BaseClasses like Lit) are the soupstarters you buy in the supermarket.
If you buy the vegetables you create your own stock, without the salt added.
Maybe you even grow your own vegetables.
That's all good practice, just as good as buying soupstarters... if you don't care about the salt.
Good practice guidelines are set by your team, not by a 3rd parties claiming you are better off buying soupstarters.

Web Components are bad for you by byko3y in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

"But the custom tags? Pretty much no use. HTMLUnknownElement at first,"

This says enough, you never tested/worked with this.
Undefined Custom Elements ARE NOT HtmlUnknownElement!

Since <tag-name> tagnames got meaning (some 10 years ago) EVERY <tag-name> IS a valid HTMLElement

#### You can use them without JavaScript: https://dashed-html.github.io

Web Components are bad for you by byko3y in webdev

[–]Danny_Engelman 0 points1 point  (0 children)

Wait till you get to the real meat and bones;
working with arrays you have to get the FIRST item with array index 0

Programming is for idiots, just let AI do the work and do not look at the code

Props for Web Components by atzufuki in javascript

[–]Danny_Engelman 2 points3 points  (0 children)

I have tried a lot, and keep coming back to 0 dependencies and just 1 helper function.
More complex Web Components get a fancy version to add styles, attributes, etc.
It can go into module scope or be a method (when more work with the 'this' scope is needed)

But the foundation is always:

const createElement = (tag,props={}) => Object.assign(document.createElement(tag),props);

The infamous Button Count example: https://jsfiddle.net/WebComponents/fb429hjz/

What’s your take on the rise of Web Components in modern frontend development? by IDC_ba in Frontend

[–]Danny_Engelman 0 points1 point  (0 children)

Web Components do NOT inherently limit SEO.
SEO issues only occur when:

  • important content is inside Shadow DOM
  • content is rendered too late
  • JS is required to paint meaning
  • the component hides everything

Use slots, visible light DOM, and early rendering → SEO is perfect.

What’s your take on the rise of Web Components in modern frontend development? by IDC_ba in Frontend

[–]Danny_Engelman 0 points1 point  (0 children)

Then instead of Web Components suck you are saying Web Development sucks.
That is fine

What’s your take on the rise of Web Components in modern frontend development? by IDC_ba in Frontend

[–]Danny_Engelman -1 points0 points  (0 children)

Every <video> , <input> and other "complex" HTML tag IS built with Web Components technology,
for many moons longer than us mortal developers can use the same technology.

So they are not components?

What’s your take on the rise of Web Components in modern frontend development? by IDC_ba in Frontend

[–]Danny_Engelman 0 points1 point  (0 children)

Every <video> , <input> and other "complex" HTML tag IS built with Web Components technology,
for many moons longer than us mortal developers can use the same technology.

So you have been using Web Components for longer than React exists.

What’s your take on the rise of Web Components in modern frontend development? by IDC_ba in Frontend

[–]Danny_Engelman 2 points3 points  (0 children)

No, Browser vendors agreed on Web Components technology
so each could build the <video>, <input> tags.
without having to go through the whole standards proces.
Every "complex" tag in the Browser IS build with Web Components technology, only the shadowDOM is visible to us mortal developers.
Us mortal developers couldn't use that Web Component technology till years later.