Why no data-* elements? [closed] - html

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
This is a question to mostly satisfy my curiosity: with the growth and acceptance of larger javascript frameworks the last, say, 5 years, it has become increasingly common to have attributes on elements add custom behavior to known html elements. For this reason html5 introduces data-* attributes, which just about every tool, including the browser parsing the dom actively ignores while rendering but are key for Js framework to enrich html as full-fledged application platform.
With Angular directives (for example), app builders enrich html as a whole by adding the ability to even create custom elements. The thing is however, this is where editing tools, like Visual Studio, break, since they like to actively check if the html elements you add exist.
Now, my question is not about visual studio (I know how to disable html validation), but why did the creators of the html5 standard never considered to include data-* elements as well? Or maybe they did, and the idea was discarded somehow. Does anyone know?

The data- prefix is actually part of the HTML5 draft
these attributes are for semantic HTML; as an example, attaching a database ID to an HTML element so that HTML parsers can use this data. In the case of Angular, the custom attributes do not carry data; they extend HTML.
Mozilla has some guidelines on the topic of the data prefix: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes
Edit The intent of HTML elements is to carry content to be displayed by the browser, attributes to attach meta-data to these elements and <head> to attach meta-data to the whole document. There are no data- elements in HTML so it's consistent with that design.

Related

Why do I need those tags? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Why do I need those tags ? :
Footer
Main
Article
Section
Form
Even if I don’t use those tags, I can get the same result, so what's the point of using these tags at all?
From MDN:
The HTML5 specification introduced several semantic sectioning elements to help organize the structure of documents. Semantic sectioning elements are specifically designed to communicate structural meaning to browsers and other technologies interpreting the document on behalf of users, such as screen readers and voice assistants.
Semantic sectioning elements clarify the larger-scale structures within a document. They are intended to enhance the limited semantics of earlier versions of HTML, which included only the tag as a generic mechanism for grouping related content
To mention also:
Important: There are no implementations of the proposed outline algorithm in web browsers nor assistive technology; it was never part of a final W3C specification. Therefore the outline algorithm should not be used to convey document structure to users. Authors are advised to use heading rank (h1-h6) to convey document structure.
and this is why you can't find any resources, because it is not standardized, and so it hasn't a common significance
Originally, HTML was all about formatting. That's why you have tags like b and i. Those tags tell you how the page is supposed to look, but they tell you nothing about what the data actually means. Over time, there's been a movement towards separating meaning and the appearance (especially with the advent of HTML5). That's why those tags exist.
With regards to your list, note that the form tag is different than the other ones you list - that particular one means that all of the input tags inside the form are intended to be sent to a server.
Yes, you can definitely do all such things without all these tags but it helps the browser to understand your code better and it will help you when you make big/complex website to understand edit your code easily.

what are draw backs of using custom HTML tags? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
what are most critical draw backs of using custom HTML tags? I need to create custom HTML5 tags and looked it up and found pros and cons list but now I'm looking for a draw back that might lead to a huge failure. can anyone help me with that please.
By definition a custom tag is an HTML element that its properties are defined by programmers as opposed to the user agent. basically, custom elements provide a tool for programmers to build their own DOM elements. Programmers can always use non-standard elements in their documents, with application-specific behavior added after the fact by scripting or similar, such elements have historically been non-conforming and not very functional. creating a custom element, we can inform the parser how to properly construct an element and how elements of that class should react to changes.
having said that, the biggest drawback is that, simply defining an element doesn’t mean that the element inherits all attributes and properties as you intended. for example if you create a tag, that doesn’t mean that your newly created tag is suppose to act like a button.

Generic Presentation Block vs Generic Structural Block [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I generally think generally think of div as a generic structural block, and my mental designation for a generic presentational block is different. In practice I use <div class='flair'></div> with a media query to hide most 'flair' on small screens. My use of the flair class seems more suited to its own tag (as opposed to a class), but there's nothing in the HTML element reference that fits this description, and the HTML spec in general seems to be moving away from presentational tags. I'm wondering if other people have considered a tag like this, or if the fact that I'm asking this question at all implies that I think of HTML elements differently than most.
For clarity, I think of a 'generic presentational block' as one that meets most of this criteria:
is not required to understand the content of the page
contains no text, anchors, buttons
is not flow content
So, I have some questions:
Do other people use a specific class to denote generic presentational blocks?
Do you feel like an existence of such a tag would improve the HTML that most developers write? (context: I generally consider div soup to be a negative)
How would you feel about browsers having a builtin feature that disables this tag. This feature would be a superset of tools like adblock and noscript
Regardless of whether the question is relevant or not - I understand what you mean about "div soup," but since your flairs are semantically meaningless I think it's technically fine.
I work with a developer who uses the <i> tag with a role="presentation" attribute added. Honestly, I haven't really looked into the use of <i> but using role="presentation" for accessibility purposes may be something to look into if you haven't already? And can be used to hide presentational flairs on mobile.
https://w3c.github.io/aria-in-html/#presentation

What is the benefit of semantic tags? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm following a tutorial series on web development. While I already have a basic understanding of HTML and how to use it to structure a page, I'm indulging myself and watching the very beginner tutorials. The funny thing is, in these tutorials the author is using tags like address and cite. When he describes why one should use these tags, he explains it only as "semtantics."
While I feel like these tags may have been more prevalent ten years ago, I never run across anyone using them besides this guy. Given he is professional, I'm now conflicted on whether or not its really necessary to use them. What is the benefit?
According to the current HTML5.1 specification nightly (as modern as it gets):
The address element is valid perfectly fine to use and so is the cite element. While a lot of sites tend to mostly use tags like div and span you can feel safe to use both address and cite .
I think it's good practice that will help you later when you have to read your HTML again to insert changes. It improves accessibility of your document as well as lets parsers other than browsers understand it better.
(Note, address and cite are legal in the old HTML specification too)
The benefit of semantic tags is that they give your html some structure - by using them you are encoding meaning into your html that can be useful in all kinds of areas. Search engines often use semantic tags to assist in ranking pages, to use a simple example. Whilst it might not always seem necessary, it is good to get into the habit of using them wherever possible.

Are you familiar with <ins> tag in html? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I just found that google uses this tag for adsense,
but seems it also works without this tag,why they prefer to use it?
The <ins> tag is used to indicate content that is inserted into a page and indicates changes to a document. According to the HTML spec this was intended primarily for use in marking up versioning of a document.
Clients that aware of this tag may choose to display content inside this tag differently or not at all depending on what they are designed to do. This is very much semantic HTML
As for why Google decide to use it I couldn't say
INS is semantic tag describing something that is inserted to the text after the text was already published. It is not a big deal, it is I guess used by their robots to understand something they care about.
Adding semantics to markup allows tools to extract more meta data from them. Google is in the business of writing such tools, so has good reason to encourage the use of code that they can use.