jgallen23 / toc

Table of Contents Plugin
http://projects.jga.me/toc/
MIT License
531 stars 111 forks source link

Immediately-Invoked Function Expression, locally pass in the windows object, remove unnecessary vars, and updated Demo #9

Closed gfranko closed 11 years ago

gfranko commented 12 years ago

Immediately-Invoked Function Expression

Wrapped the plugin in an Immediately-Invoked Function Expression (best practice)

Windows Object

Locally passed in the windows object to be minifier friendly.

Unnecessary var statements

Unnecessary var statements were also removed, since you only need to declare var for the first variable declaration.

Example Demo

The example demo was also updated to more reflect the demo on the project homepage.

jgallen23 commented 12 years ago

just an FYI !function() {}() is the same as (function() {}), but 1 less byte. :-)

I'll take a look at the rest today

gfranko commented 12 years ago

Interesting... I never knew that! Awesome work on the plugin. I might post one or more bug fixes later today.