arielsalminen / TinyNav.js

Responsive navigation plugin that weighs just 443 bytes
http://tinynav.viljamis.com/
635 stars 207 forks source link

let's make it real tiny then :) #1

Closed tuomassalo closed 12 years ago

tuomassalo commented 12 years ago

Some tweaks around the code for some (quite futile) byte optimization.

Also, for safety, use text() and val() to set up the <option> tags.

BTW, I think the 350 bytes gzipped is a bit optimistic.

kristerkari commented 12 years ago

As an addtion to this pull req: $select.bind('change', function () { could be $select.change(function () {

and .attr('selected', 'selected'); could be written .attr('selected', true);

right?

kristerkari commented 12 years ago

Hmm..

I think you could change this as well: $nav.addClass('l_' + namespace_i); $(this).find('a').each(function () {

to:

$nav.addClass('l_' + namespace_i).find('a').each(function () {

arielsalminen commented 12 years ago

Thanks for these @kristerkari & @naapuri . I'll look into these later when I have a bit more time, probably during the weekend.

About the size: I do think it's correct. At least closure reports 350 bytes minimized & gzipped, without the copyright stuff on top.

arielsalminen commented 12 years ago

Implemented all these changes, the size dropped to 319 bytes : )