3 ms·
> While allowed due to backward compatibility to XHTML, they have never been specified, do nothing, and browsers ignore them so it is pointless to put them ther
by fnord123 3y ago
> While allowed due to backward compatibility to XHTML, they have never been specified, do nothing, and browsers ignore them so it is pointless to put them there.
What do you mean by "never been specified"? They are in the spec: https://www.w3.org/html/wg/spec/syntax.html#start-tags https://www.w3.org/html/wg/spec/syntax.html#start-tags
> Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.
- assimpleaspossi 3y agoYou are looking at what I said. What you are quoting says it's allowed, and it "has no effect", but if you look at the actual element specification[1], it never says to use it. In fact, it says nothing at all about it. [1] https://html.spec.whatwg.org/dev/input.html#the-input-element https://html.spec.whatwg.org/dev/input.html#the-input-elemen... You will never find any HTML specification which will tell you a closing slash is required or that it has any meaning or does anything at all.
- alpaca128 3y agoIt very clearly says it has no effect on void elements, and then directly follows up with describing the effect it does have. And the link you provided is specifically for the input tag, which has nothing to do with the syntax definition in general. Why would they repeat a generally applicable rule in more specific sections?
- assimpleaspossi 3y agoI added some links to my original post that you need to read. That the specification for the input element--and ALL HTML elements--does not state to use a closing slash should mean something or at least indicate something. If it's required or has meaning you would think the specification would show that. It doesn't. It never has. You also need to read up on what a foreign element actually is and it's not HTML.
- HackerThemAll 3y ago[flagged]
- assimpleaspossi 3y agoYou are repeating what has already been stated and explained. Throwing insults doesn't change what's already been written.
- HackerThemAll 3y agoAnd you're still not understanding what's written there.
- ricardobeat 3y agoYour point is still unclear there. The specification allows it, for historical reasons. The fact it doesn’t recommend it does not change that. Many people, myself included, prefer to have code that is easily parseable (both mentally and by a program) without requiring a lookahead or awareness of a list of special elements. A slash for self-closing elements achieves that. It just makes sense. Can you imagine JSX allowing this?
- assimpleaspossi 3y agoIn order to put a slash there, you need to already know that tag can take a slash, so nothing is gained by putting it there. Though something is allowed, it is unspecified, not required, does nothing. So why would you want to write markup that is not needed and does nothing? This makes no sense whatsoever and I only find such discussions on public forums such as this one.
- ricardobeat 3y agoThis is about readability. The point is that only if you _don't_ have an ending slash, you need to know the tag type. If there is one, you don't need to know anything to understand the tree structure, the code is self-evident. Do you add quotes to your single-word attribute values? Why? They are also unnecessary following the spec: https://html.spec.whatwg.org/#unquoted https://html.spec.whatwg.org/#unquoted Do you omit the opening html tag because it's optional? https://html.spec.whatwg.org/#optional-tags https://html.spec.whatwg.org/#optional-tags Do you write unclosed <dd> tags? Do you close your paragraph elements? The spec allows a lot of questionable styles, your argument that because something is not required it is superfluous doesn't hold any water.