Skip to content

Commit

Permalink
Merge branch 'jasondavies-new_closure_compiler' into mbostock-master
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Mar 12, 2011
2 parents 996e21e + 651fb56 commit a6d5b6f
Show file tree
Hide file tree
Showing 12 changed files with 191 additions and 145 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -136,6 +136,7 @@ d3.geom.js: \
tests: \
tests/test-append.test \
tests/test-attr.test \
tests/test-call.test \
tests/test-format.test \
tests/test-transition.test \
tests/test-scale-linear.test \
Expand Down
4 changes: 2 additions & 2 deletions d3.geo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions d3.geom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions d3.js
Expand Up @@ -195,10 +195,19 @@ function d3_splitter(d) {
function d3_collapse(s) {
return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
}
//
// Note: assigning to the arguments array simultaneously changes the value of
// the corresponding argument! However, the Google Closure compiler doesn't
// realize this, and so can optimize-away our attempt to avoid side-effects.
// This fix by Jason Davies has been tested to survive minimization.
//
// TODO The `this` argument probably shouldn't be the first argument to the
// callback, anyway, since it's redundant. However, that will require a major
// version bump due to backwards compatibility, so I'm not changing it right
// away.
//
function d3_call(callback) {
var f = callback;
arguments[0] = this;
f.apply(this, arguments);
callback.apply(this, (arguments[0] = this, arguments));
return this;
}
/**
Expand Down

0 comments on commit a6d5b6f

Please sign in to comment.