javascript 为什么 jQuery 不是 W3C 标准?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11312787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why jQuery is not a W3C standard?
提问by Gnanam
I've read and heard that jQuery is nota W3C standard but at the same time I couldn't find the reason why it is so. Any explanation with reasoning are appreciated.
我已经阅读并听说 jQuery不是W3C 标准,但同时我找不到它的原因。任何有推理的解释都值得赞赏。
EDIT:OK, may be I should reword/rephrase my original question. Actually, the question I had in my mind was -- Does jQuery follow W3C standards?
but while posting it just got reworded.
编辑:好的,也许我应该改写/改写我原来的问题。实际上,我心中的问题是——Does jQuery follow W3C standards?
但在发布它时,它被改写了。
回答by D. Strout
There are already W3 standards for selecting and manipulating elements, jQuery is just a library that facilitates that. In other words, it is possible to do everything jQuery can do with regular JavaScript, so there is no reason to make it any kind of standard.
已经有用于选择和操作元素的 W3 标准,jQuery 只是一个促进这一点的库。换句话说,jQuery 可以用普通的 JavaScript 做任何事情,所以没有理由让它成为任何类型的标准。
As to the edited version "does jQuery follow W3C standards", the answer is no. It uses non-standard properties and methods like innerHTML, as well as some browser-specific properties. Though it does this in a way that is useful and creates an "abstraction layer" that helps developers access these properties easily without worrying as much about browser compatibility, jQuery still does go against certain standards.
至于编辑后的版本“jQuery 是否遵循 W3C 标准”,答案是否定的。它使用非标准属性和方法,如innerHTML,以及一些特定于浏览器的属性。尽管它以一种有用的方式做到这一点,并创建了一个“抽象层”,帮助开发人员轻松访问这些属性,而不必担心浏览器兼容性,但 jQuery 仍然违反某些标准。