且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

自定义属性vs data- *属性

更新时间:2023-11-26 23:10:10

实际上,一些浏览器可以实现具有完全不同含义的 bind

Practically, some browser can implement bind with a totally different meaning.

您正在使用它来进行Knockout,但是假设新意义是不同的。当您更改一个元素上的内联CSS时,它应该根据bind属性中的选择器将其更改为另一个元素。

You're using it for Knockout, but hypothetically the new meaning is different. When you change the inline CSS on one element, it should change it on another element based on a selector in the bind attribute.

有理由尊重标准并使用私有(例如数据)或供应商特定的前缀。

There's a reason to respect standards and use private (e.g. data-) or vendor-specific prefixes.