问题描述
我使用HTML Validator Firefox附加组件,当我进入,我收到有关 data-bind
属性的警告(对于实例):
例子:
< select>
专有属性data-bind
<按钮>
专有属性data-bind
在。
我知道这个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验证警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!