News for hackers. Stuff that matters.
Re:Learn SVG with 25 examples – How to code images in HTML by ChrisMarshallNY on Thursday December 07, 2023 @02:43PM (#38560869)
That's a great tutorial.

One niggle: They refer to the SVG "tag." I had started HTMLing in the mid-1990s, and we always called everything "tags."

Then, XHTML came in, and people started screaming at us for calling them "tags." They were elements, dammit!

I say "element," these days, but my brain still says "tag."

Re:Learn SVG with 25 examples – How to code images in HTML by Archelaos on Thursday December 07, 2023 @03:23PM (#38561370)
In XML terminology (where XHTML derives from), "tags" are the delimiters of "elements". So we have "start-tags", "end-tags", and "empty-element-tags".[1] "Element" refers to the composition of the delimiting tags and all of their (nested) content.[2]

[1] https://www.w3.org/TR/xml/#sec-starttags

[2] https://www.w3.org/TR/xml/#sec-logical-struct

Re:Learn SVG with 25 examples – How to code images in HTML by ChrisMarshallNY on Friday December 08, 2023 @06:28AM (#38567744)
That makes great sense.

I never used "tag" properly, then.

But for complete elements, like <br /> or <hr />, would it be proper to refer to them as "tags"?

Re:Learn SVG with 25 examples – How to code images in HTML by d1sxeyes on Friday December 08, 2023 @08:23AM (#38568703)
Depends on what you’re talking about, to be honest. The “element” is the “thing”. The “tag” is how you tell the browser what you want.

This is why you have DOM functions like “getElementsByTagName”, which allows you to say “I know the tag name is “hr” (and the tag is <hr />), but I want to get references to all the elements which are defined by that tag.

As a general rule, if you’re thinking about a “thing” on a webpage, you’re think about an element. If you’re thinking about what you need to write to get that element to appear on the webpage, you’re thinking about a tag.

Most of the time, folks will understand what you mean even if you use the wrong one though.

Re:Learn SVG with 25 examples – How to code images in HTML by Archelaos on Saturday December 09, 2023 @05:30AM (#38580578)
In XML, they are referred to as "empty-element tags" and are functionally equivalent to a start tag immediately followed by an end tag, such as <br></br> or <hr></hr>. If a tag has no content, it can in principle also be written as an empty-element tag, for example: </p>. However, such use is not recommended: "For interoperability, the empty-element tag SHOULD be used, and SHOULD only be used, for elements which are declared EMPTY."[1] "For interoperability" is defined as: "Marks a sentence describing a non-binding recommendation included to increase the chances that XML documents can be processed by the existing installed base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879."[2a] "SHOULD" is explicitly[2b] used as defined in RFC 2119: "This word [...] mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course."[3]

[1] https://www.w3.org/TR/xml/#NT-EmptyElemTag

[2a][2b] https://www.w3.org/TR/xml/#sec-terminology

[3] https://www.ietf.org/rfc/rfc2119.txt

Re:Learn SVG with 25 examples – How to code images in HTML by HunorBorbely on Thursday December 07, 2023 @02:56PM (#38561030)
It's an interesting point. Writing tutorials like this also made me realize what's the difference between a function property and a function argument. I just used them completely interchangeably before. So element is more accurate here?
Re:Learn SVG with 25 examples – How to code images in HTML by ChrisMarshallNY on Thursday December 07, 2023 @03:39PM (#38561510)
SVG is basically an expression of XML, and XML uses "element" for everything, so it would be more appropriate, but, TBH, I really don't think anyone reading gives a damn.

I have done a ton of tutorials, myself, and have found that using vernacular, and expressing in basic, readable language, always works best. Being too pedantic can make it seem "stilted."

Re:Learn SVG with 25 examples – How to code images in HTML by dragonwriter on Thursday December 07, 2023 @03:43PM (#38561562)
AFAIK, XML gets it from HTML (which was its inspiration), which got it from SGML (of which HTML was originally an application), all use "element".

But, yes, SVG is an application of XML.

Re:Learn SVG with 25 examples – How to code images in HTML by padjo on Thursday December 07, 2023 @02:50PM (#38560957)
Ah XHTML the web’s dark age of pedantry. Call them whatever you want man, we’re much chiller in the HTML5 era.
Re:Learn SVG with 25 examples – How to code images in HTML by quickthrower2 on Thursday December 07, 2023 @03:52PM (#38561669)
XHTML strictness would have been a great start but at that point the "best-effort" <p><div>cat was out of the bag</span>

I mean what is worse? Incorrectness, or losing ad revenue :-)

Re:Learn SVG with 25 examples – How to code images in HTML by antod on Thursday December 07, 2023 @10:18PM (#38565041)
As others have pointed out, elements and tags are different things and always were. An element is the thing comprised of tags and the content between them. eg <tag>content</tag> is an element.

https://developer.mozilla.org/en-US/docs/Glossary/Tag