开发者

JQuery source code - absolutely unreadable?

Is it just me or any JavaScript DOM manipulation or WEB UI Framework code is really hard to grasp because of long files, lack of proper indentation and scarcity of comments?

I have read couple good book on JavaScript and like the language, bu开发者_C百科t when trying to understand the inner workings of all the popular frameworks I am having hard time to force myself to go beyond first hundred lines of a huge file.

This is a real question, not a statement. I am just trying to understand if I just suck or somebody else sharing my impressions.


Oh boy. First, stop trying to reverse-engineer minified and obfuscated javaScript. Second, it's open-source and documented.


Who said he is reading minified code?

This question might be closed, but yes, jQuery has some rather unreadable source and bad organization. Organization in that John Resig thought it was a good idea to throw everything onto a single constructor and its prototype.

I guess if you want a DOM library that is well commented, try looking at Prototype. It's actually very overcommented in my opinion, but if you want it as a reference for various DOM quirks and mechanics, it might be a good source.


The minified version is indeed not human-friendly, but it's smaller and faster. You're looking for the development version.


Whilst I can understand your frustration, jQuery (and other APIs, C++'s STL springs to mind) are not meant to be read by the average engineer. They are optimised for their purpose and excel at doing so, and that's why everybody uses them. Tried and tested.


Genarally jQuery uses a lot of closures and the notation of the framework as well as the plugins define a lot of anonymus functions on the go. So it's not easy "following" the way of the data through the code. At least that is my limited understanding. So if You just suck, You're definetely not the only one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜