Warnings for valid HTML5 attributes in Eclipse

I use Eclipse and I am writing jsp files with HTML5 content. Therefore, I have, for example, this line:

<div class="test" data-role="test123"> 

In Eclipse, I get a warning:

 Undefined attribute name (data-role) 

What needs to be done to prevent these warnings from appearing again? In HTML5, this attribute is allowed (data- *), as you can see here: http://ejohn.org/blog/html-5-data-attributes/

Regards.

+43
eclipse html5
Nov 16 '10 at 12:03
source share
6 answers

It seems that Eclipse still has some issues checking HTML5 elements and attributes even now.

I run Mars 4.5.1 and I had warnings about the <main> element, even though there are no warnings about the <section> element.

But there is a solution!

 Window > Preferences > Web > HTML Files > Validation 
โ†’ โ†’ โ†’ โ†’ โ†’ โ†’ โ†’

Here you can check the box Ignore specified element names in validation and enter the names of any elements that Eclipse does not warn you about correctly.

In your case, you need to check the Ignore specified attribute names in validation checkbox and enter the data-role attribute.

After clicking the "Apply" button, Eclipse will ask you to perform a full check of the project. Select "Yes" and the changes will take effect.

No shorter yellow lines YAY !: D

+19
Feb 16 '16 at 15:12
source share

Your doctype

for HTML 4.01.

Attributes added in HTML 5

data- *. The doctype type for HTML 5 is basically either

 <!DOCTYPE html SYSTEM "about:legacy-compat"> 

or

 <!DOCTYPE html> 
+13
May 15 '15 at 12:37
source share

Newer versions of Eclipse support HTML5 tags and data- * attributes, which are allowed in HTML5. However, when using the role attribute, the correct syntax according to the ARIES Roles Model and the XHTML module attribute does not prefix the role attribute with data - * , leaving only the role and not the data role.

So, <ul role="menubar"> rather than <ul data-role="menubar"> . Syntax validation can be verified using (X) HTML5 Validator . jQuery Mobile uses the data-role attribute quite widely, although I'm not sure why.

Note. . If you are updating and still receiving warnings about data- * attributes, you might consider updating or removing any installed parsers, such as JTidy. Starting with version 1 of the Indigo service, the role attribute continues to trigger the warning of the undefined attribute in Eclipse by default.

+9
Nov 12 2018-11-11T00:
source share

I used this option with Aptana 3.6 when coding AngularJS

Window> Preferences

Choose Ignore Proprietary Attributes

+3
Nov 20 '14 at 2:14
source share

I am using the Aptana Studio plugin on Mac OS X; if I go to Eclipse > Preferences > Aptana Studio > Validation > HTML and create a filter *data-role* , I no longer get this warning.

I believe that on Windows this is Window > Preferences > Aptana Studio > Validation > HTML

Aptana HTML Validation

+2
Jan 18 2018-12-18T00:
source share

Eclipse 3.6 introduced a new field under:

Validation -> HTML Syntax: Ignore specified attribute names in validation

Add OpenGraph, RDFa, or other non-HTML5 attributes that you want the validator to ignore:

Ignore specified attribute names in validation

You will need to re-check the project, after which there will be no warnings.

+2
Sep 16 '15 at 16:47
source share



All Articles