Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

html - Warnings of valid HTML5 attributes in Eclipse

I use Eclipse and I write jsp files with HTML5 content. So I have for example this line:

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

In Eclipse I get the warning:

Undefined attribute name (data-role)

What needed to be done so these warnings won't appear anymore? In HTML5 this attribute is allowed (data-*) as you can see here: http://ejohn.org/blog/html-5-data-attributes/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems like Eclipse still has some problems validating HTML5 elements and attributes even now.

I'm running Mars 4.5.1 and I have had warnings about the <main> element, despite the fact that there are no warnings about the <section> element.

But there is a solution!

Window > Preferences > Web > HTML Files > Validation

Window > Preferences > Web > HTML Files > Validation

Here you can tick the Ignore specified element names in validation checkbox and enter the names of any elements which Eclipse is incorrectly warning you about.

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

After you click 'Apply', Eclipse will ask you to do a full validation of the project. Select 'Yes' and the changes will take effect.

No more squiggly yellow lines YAY! :D


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...