How to get 'name' attribute of item of string-array?

Why does the "data-name" attribute in the Quora follow button fail W3C validation?

  • For the record, I am validating with transitional XHTML Line 107, Column 50: there is no attribute "data-name"…="quora-follow-button dark" data-name="Alex-K-Chen">Follow <a href="http://www… ✉ You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead). This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information. How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

  • Answer:

    As far as I know, data-* attributes are only valid in HTML5. As you are using XHTML, the data-name attribute doesn't exist and is therefore invalid. I'm not sure what happens when you use XHTML5 though.   Also, because XHTML is all lowercase the capital letters in your name might be giving you some grief, although the error doesn't seem to suggest that this is the problem.

Thomas Foster at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.