josecebe / twbs-pagination

jQuery pagination plugin (bootstrap powered)
http://josecebe.github.io/twbs-pagination/
Other
1.1k stars 402 forks source link

small optimization for jquery #56

Closed pavelthq closed 9 years ago

pavelthq commented 9 years ago

currently in js I see:

            this.$element.first().on('page', this.options.onPageClick);

which possibly can simply changed to:

            this.$element.on('page', this.options.onPageClick);

@esimakin , maybe you know what is a purpose for first() and maybe it is not needed?

as we know $element always should be a single, so first() doesnt make sense?

eugenesimakin commented 9 years ago

Need to check multiple paginators. @AngeIII , see Synchronized pagination elements example at gh-pages branch

pavelthq commented 9 years ago

Work fine on gh-pages without first() after debugging, I confirmed that without first() onPageClick callback called for all synchronized paginations multiple times. So first() is needed only to execute once onPageClick action.