aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorIgor Minar2011-11-28 22:07:33 -0500
committerIgor Minar2011-12-05 14:12:00 -0800
commit2986a09c0d9385f1bc1c74255e8b66f6d71ff5dd (patch)
tree1ad3ad0e656678a2745b4d2104cf518dc99dd5fc /src/jqLite.js
parentbb2e7488fa7defea53e7dc3f5ab58fb4f837d2b6 (diff)
downloadangular.js-2986a09c0d9385f1bc1c74255e8b66f6d71ff5dd.tar.bz2
fix(jqLite): JQLiteHasClass should work even when minified
closure compiler is smarter than we expected and drops the unused fn argument - this breaks the meta-programing logic of jqLite. The fix special cases JQLiteHasClass since its the only fn that needs this treatment in a way that is minification-proof.
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index ec0d327e..1f640740 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -219,9 +219,7 @@ function JQLiteData(element, key, value) {
}
}
-function JQLiteHasClass(element, selector, _) {
- // the argument '_' is important, since it makes the function have 3 arguments, which
- // is needed for delegate function to realize the this is a getter.
+function JQLiteHasClass(element, selector) {
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").
indexOf( " " + selector + " " ) > -1);
}
@@ -427,7 +425,9 @@ forEach({
JQLite.prototype[name] = function(arg1, arg2) {
var i, key;
- if ((fn.length == 2 ? arg1 : arg2) === undefined) {
+ // JQLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+ // in a way that survives minification.
+ if (((fn.length == 2 && fn !== JQLiteHasClass) ? arg1 : arg2) === undefined) {
if (isObject(arg1)) {
// we are a write, but the object properties are the key/values
for(i=0; i < this.length; i++) {