Knockout.js数据绑定属性会导致HTML验证警告 [英] Knockout.js data-bind attribute causes html validation warning

查看:75
本文介绍了Knockout.js数据绑定属性会导致HTML验证警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用HTML Validator Firefox附加组件,当我进入 http://knockoutjs.com的主页时/ ,我收到有关 data-bind 属性的警告(对于实例):

例子:

< select> 专有属性data-bind

<按钮> 专有属性data-bind

http:// validator中提交URL时, data-bind 属性.w3.org /

我知道这个html属性被knockout.js用来做一些数据绑定,但是我们可以得出这样的结论:不遵循HTML规范? knockout.js是否遵循有效的HTML标记的精神?

解决方案

它们是HTML 5自定义属性。尝试验证对照HTML 5规范,并且您应该在验证中得到确认。



但是,只要您认为合适,您可以使用自定义属性,尽管它可能违反了严格的HTML 4规范。

I'm using the HTML Validator firefox add-on and when I go to the home page of http://knockoutjs.com/, I get warnings about the data-bind attribute (for the Live Example):

Examples:

<select> proprietary attribute "data-bind"

<button> proprietary attribute "data-bind"

I also get errors regarding the data-bind attribute when submitting the URL at http://validator.w3.org/.

I know this html attribute is used by knockout.js to do some data binding, but can we conclude that this approach does not follow the HTML specification? Does knockout.js follow the spirit of valid HTML markup?

解决方案

They are HTML 5 custom attributes. Try to validate against HTML 5 specs and you should get an ok on the validation.

But since long you have been able to use custom attributes as you see fit although it may have violated strict HTML 4 specs.

这篇关于Knockout.js数据绑定属性会导致HTML验证警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆