udacity / frontend-nanodegree-feedreader

Other
72 stars 1.67k forks source link

redundant parentheses make jQuery $ .ready function useless #18

Closed flowmemo closed 5 years ago

flowmemo commented 8 years ago

https://github.com/udacity/frontend-nanodegree-feedreader/blob/master/js/app.js#L134 https://github.com/udacity/frontend-nanodegree-feedreader/blob/master/jasmine/spec/feedreader.js#L72

In each of above two lines, there is a pair of parentheses make function expression become an IIFE(Immediately-invoked function expression), which return undefined.

If we want to utilize jQuery's .ready function (https://api.jquery.com/ready/), we should pass a function object to it, not undefined.

I made this PR #17 .

flowmemo commented 8 years ago

It may seem no difference when run this application, but if you log document.readyState in top of these function expression, you would see it is ''loading". After delete those redundant parentheses, document.readyState is ''interactive“.

You can checkout "log-origin" and "log-patch" branches in my fork.

flowmemo commented 8 years ago

Someone has mentioned the same issue before in this PR #10