Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 426939 - [hotbug] [validator] HTML5 attribute validator marks ng-app AngularJS attributes as undefined
Summary: [hotbug] [validator] HTML5 attribute validator marks ng-app AngularJS attribu...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.html (show other bugs)
Version: 3.5.1   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 3.5.2   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard: PMC
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-29 15:29 EST by Victor Rubezhny CLA
Modified: 2014-01-30 09:51 EST (History)
13 users (show)

See Also:
nsand.dev: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
nsand.dev: pmc_approved? (naci.dai)
nsand.dev: pmc_approved? (neil.hauge)
nsand.dev: pmc_approved? (cbridgha)
nsand.dev: pmc_approved? (kaloyan)
nsand.dev: review+


Attachments
Patch to backport the "core" part of the fix made for bug #415980 (18.63 KB, patch)
2014-01-29 16:00 EST, Victor Rubezhny CLA
no flags Details | Diff
Patch to backport the "core" part of the fix made for bug #415980 (20.30 KB, patch)
2014-01-29 16:13 EST, Victor Rubezhny CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Rubezhny CLA 2014-01-29 15:29:29 EST
+++ This bug was initially created as a clone of Bug #415980 +++

HTML5 attribute validator marks the ng-app AngularJS attributes as undefined: 

Warning:
Undefined attribute name (ng-app).
Undefined attribute name (ng-controller).

The AngularJS is well known and popular JS-tool which is widely used by HTML5 developers, so, having these warnings become more and more annoying.
Why we cannot make them to be 'known' by the HTML Attribute Validator as it's done for 'x-' and 'data-' attributes?

The adopter of WST Source Editing Tools requests for back porting of org.eclipse.wst.html.core changes made to fix bug #415980 into WTP 3.5.2. This includes:

1. Two new preferences added that allow to ignore specified attribute names in validation and to specify the attribute names to be ignored;
2. Preference Initializer is made to init these new preferences;
3. HTMLAttributeValidator is made to understand and use these preferences
Comment 1 Victor Rubezhny CLA 2014-01-29 15:56:42 EST
Explain why you believe this is a stop-ship defect:
* It's impossible to made HTML Attribute Validator not to mark HTML5 attribute names as unknown. 

Is there a work-around? If so, why do you believe the work-around is insufficient?
* No, there is no way to configure the validator due not to validate some attribute names that are known for adopter's product.

How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?
* Tested by running org.eclipse.wst.html.core.tests and org.eclipse.wst.html.ui.tests JUnit Test Suites on R3_5_maintenance branch. All tests are passed with no errors. Also, the manual testing was performed on WTP HTML Editor and Validator.

Give a brief technical overview. Who has reviewed this fix?
* The fix is a back port of core part of the fix made in bug #415980. Here it adds two preferences to the HTML Core, the initialization of these two preferences and makes the HTML Attribute Validator to properly react on the value of these new preferences. These preferences specify if some tag attribute names should be excluded from the validation and allow to set up such attribute names. No UI changes are made by this fix.

What is the risk associated with this fix?
* Low. All JUnit Tests are good after applying the patch in R3_5_maintenance branch. Smoke testing shows that Validation and HTML Editor work well.
Comment 2 Victor Rubezhny CLA 2014-01-29 16:00:14 EST
Created attachment 239446 [details]
Patch to backport the "core" part of the fix made for bug #415980
Comment 3 Victor Rubezhny CLA 2014-01-29 16:13:54 EST
Created attachment 239450 [details]
Patch to backport the "core" part of the fix made for bug #415980
Comment 4 Nick Sandonato CLA 2014-01-29 16:44:12 EST
The patch looks good to me, and I can see the importance of correcting the validator as particular frameworks gain traction.
Comment 5 Nick Sandonato CLA 2014-01-29 16:54:36 EST
Thanks for the quick review, Raghu. I've pushed the changes the R3_5_maintenance: http://git.eclipse.org/c/sourceediting/webtools.sourceediting.git/commit/?id=f4f3fd5fd74846be7ef6ae0caa851d9b8e1e163b
Comment 6 Victor Rubezhny CLA 2014-01-29 16:58:23 EST
Thank you for the fix!
Comment 7 Nitin Dahyabhai CLA 2014-01-30 09:50:19 EST
String#isEmpty() isn't part of the 1.4 Execution Environment.  Released v201401301446 to fix the compile breakage.
Comment 8 Victor Rubezhny CLA 2014-01-30 09:51:59 EST
Ops, sorry! And thank you, Nitin!