W3C validation with AngularJS directives

前端 未结 2 1714
你的背包
你的背包 2020-12-03 10:10

How do we go about doing W3C validation with an Angular application?

Since custom directives make for invalid HTML validation, we typically see lots of W3C validatio

2条回答
  •  清歌不尽
    2020-12-03 10:39

    W3 Validation of Angular code online

    If you tried to validate your AngularJS code with http://validator.w3.org/, you must have noticed that it does not allow AngularJS ng-* attributes.

    One way to validate (as @rewritten explained), is to prefix your ng-* with data-, or x-.

    I do not want to do this on the 800 attributes of my app. In my point of view, it reduces the clarity of the code, especially when we use a lot of these attributes.


    The W3C HTML5 validation team has developed a tool which allow to filter errors during the validation, and accept well ng-* attributes.

    You can try it at this URL: http://validator.w3.org/nu/

    After you submit a document for checking, on the results page you’ll see a Message filtering button, and if you press that, you’ll get a list of all the error messages grouped into sets, with Show/Hide checkboxes.


    Source

提交回复
热议问题