Created by: mgcrea
It would be great if on the javascript side, for the 3.0 release, bootstrap could drop the sizzle
dependency. We can now easily get custom smaller jQuery builds. It would make sense with being "mobile first" where KBs matter a lot.
I'm currently reviewing a custom jquery2+bootstrap build for AngularStrap to pave the way for mobile apps there. Looks like most of bootstrap's javascript works with this custom build:
grunt custom:-ajax,-deprecated,-effects,-sizzle
This gives a 17KB file (min+gz) vs. 29KB, thus -42%. That's great and the jquery modularization/cleanup is only beginning.
If we take a look at the current bootstrap-tab.js
, that this PR highlights, implementation for the v2.3.1
release, to make it work with a sizzle-free build, we have to:
- replace
> .class
withchildren()
:
.find('> .dropdown-menu > .active') // unsupported
could be replace with:
.children('.dropdown-menu').children('.active')
- find a sizzle-free alternative to some positional selectors,
:first
&:last
(that do not behave like the css3:first-child
, etc.).
previous = $ul.find('.active:last a')[0]
could become:
previous = $($ul.find('.active:last').get(-1)).find('a')[0]