4

jQuery要杀死js了

 3 years ago
source link: https://yuguo.us/weblog/jquery-is-slowly-killing-javascript/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

jQuery要杀死js了

余果 2012-04-20 front-end

今天在stackoverflow上看到这么一个问题: http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-jquery LZ说:

【169】我是jQuery玩家,我想获得当前URL的参数,比如

http://localhost/menuname.de?foo=bar&number=0

这个问题相当具有代表性,有169个赞。 1L回答: 【261】要得到参数你应该这样搞:

$(document).ready(function() { var pathname = window.location.pathname; });

简洁明了的回答获得了261个赞。然后有趣的是在这个回答下面的评论,方括号中的数字是认为这条评论有用的人: 【19】关于location对象的详细说明: developer.mozilla.org/en/DOM/window.location 【35】这TMD应该是常识啊,jQuery要毁了JS。

【46】谈不上杀死JS,jQuery是让JS获得了新生。新的C#/Java程序员了解指针吗?不。他们需要了解吗?他们不需要,新的抽象足够强大,所以指针不再是必需的知识。

【68】“我怎样用jQuery ooxx?”这种问题,而答案是原生JS的这种情况很常见。你可能知道如何用原生JS完成某任务;但是由于浏览器的不一致性,你可能更喜欢用jQuery的封装方法去做。我记得在jQuery之前我会受限查阅手头的各种浏览器列表。所以jQuery是在杀死原生js,对的……但是,这也让它获得了新的生命。

【18】不用等到document.ready就可以使用这个方法了……

我写字的地方迁移到公众号啦~欢迎关注我的公众号:余果专栏

user

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK