(E.g. “<div>…</div>” in HTML is not a tag, it’s an element delimited by one starting and one ending tag.)
(E.g. “<div>…</div>” in HTML is not a tag, it’s an element delimited by one starting and one ending tag.)
> This page lists all the HTML elements, which are created using tags.
-- https://developer.mozilla.org/en-US/docs/Web/HTML/Element
The "tag" is the word between the "<" ">".
I agree that it’s a somewhat common mistake to refer to HTML elements as “tags”, but it’s unfortunate to bake that mistake into a language.
Can you provide a concrete example of a case where this usage would be confusing?
Language evolves with use, and being really passionate about an idealized standard in your head doesn't somewhat materialize it as the "correct" way.
There are certainly cases where the precision matters, but I think this is only one such case if the imprecision causes misunderstanding by users of the Imba language.
I remember ‘tag’ was used colloquially in the ‘90s - this was before Javascript was popular. When DOM became a thing in 1998, the definition was more formalized to be consistent across JS and HTML. As things stand, tags usually come in pairs, except for a few (such as <br/>?). An element is now defined as both tags + the content.
I believe this evolution happened organically, and many people still prefer the use of ‘tag’ to mean an ‘element’ for conciseness.
Update: edited for clarity
It helps lower the barrier to understanding a new concept because you have an existing concept to leap from and language to use. It comes at the cost of precision.
The words `node`, `class`, and `tag` in particular are used all over the place.
There's a reason for the joke that the two hardest things in software are cache invalidation and naming things.
Also, colloquially it's very common to use "tag" because to refer to both, because "element" is longer, including in pretty formal places like Shopify's API:
https://shopify.dev/docs/api/admin-rest/2023-07/resources/sc...
There’s not a one-to-one relationship between HTML tags and elements, so if there is a one-to-one relationship between Imba tags and HTML elements, it follows that there is not a one-to-one relationship between Imba tags and HTML tags — that’s what’s confusing.
Also, I want to re-emphasize that most people use the words "tag" and "element" interchangeably when talking about written HTML. That may be a pet peeve of yours, but it's common enough that it's not an incorrect usage.
tag Box
css pos:relative
x = 0
y = 0
<self[x:{x}px y:{y}px] @touch.moved.sync(self)> <slot> "box"
tag app
<self[inset:0 d:hflex ja:center]>
<Box[hue:blue]> 'One'