Split polyfill #617

wants to merge 3 commits into


None yet

2 participants


I modified String.prototype.trim to a smaller version, which is attributed to MDN.

Before my revision we were at:

Minified: 24.916k
Minified and gzipped: 9.080k, compression factor 5.599

Now, we're at:

Minified: 24.897k
Minified and gzipped: 9.080k, compression factor 5.608

I'm not sure how to remove commit 4c557d1, but it's already been merged.

shalecraig added some commits Oct 5, 2012
@shalecraig shalecraig Fixed a test bug 4c557d1
@shalecraig shalecraig Commit to reduce the size of Zepto.
Now using the official MDN String.prototype.trim polyfill, as
opposed to our own home-baked one.

The Uglifyjs compiler doesn't make this optimization, but Google's
Closure uses inferred types to make "safe" changes like this:

if (x === undefined) {
    x = foo();


x = x || foo();

UglifyJS doesn't make these changes. We might want to consider
moving to Closure compiler, if our aim is to produce the smallest js
@shalecraig shalecraig Removed newline at end of the file, so I added it again.
@madrobby madrobby closed this in 3771d17 Mar 3, 2013
@lopper lopper added a commit to buddydvd/zepto that referenced this pull request Apr 24, 2013
@madrobby @lopper madrobby + lopper Shorter RegExp for trim polyfill. Fixes #617 c4b45c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment