Linted select2/utils
For the most part this was semicolon fixes, but there was a function, `calledMethod`, which did need to be moved out of the loop.
This commit is contained in:
parent
ed6eb4ff92
commit
898db2e74a
@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"bitwise": true,
|
"bitwise": true,
|
||||||
|
"globals": {
|
||||||
|
"define": true
|
||||||
|
},
|
||||||
"indent": 2,
|
"indent": 2,
|
||||||
|
"maxlen": 80,
|
||||||
"quotmark": "single"
|
"quotmark": "single"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
define(function () {
|
define(function () {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
})
|
});
|
||||||
|
55
src/js/select2/utils.js
vendored
55
src/js/select2/utils.js
vendored
@ -2,7 +2,7 @@ define([], function () {
|
|||||||
var Utils = {};
|
var Utils = {};
|
||||||
|
|
||||||
Utils.Extend = function (ChildClass, SuperClass) {
|
Utils.Extend = function (ChildClass, SuperClass) {
|
||||||
var __hasProp = {}.hasOwnProperty
|
var __hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
function BaseConstructor () {
|
function BaseConstructor () {
|
||||||
this.constructor = ChildClass;
|
this.constructor = ChildClass;
|
||||||
@ -29,7 +29,7 @@ define([], function () {
|
|||||||
for (var methodName in proto) {
|
for (var methodName in proto) {
|
||||||
var m = proto[methodName];
|
var m = proto[methodName];
|
||||||
|
|
||||||
if (typeof m !== "function") {
|
if (typeof m !== 'function') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,38 +68,39 @@ define([], function () {
|
|||||||
DecoratedClass.prototype = new ctr();
|
DecoratedClass.prototype = new ctr();
|
||||||
|
|
||||||
for (var m = 0; m < superMethods.length; m++) {
|
for (var m = 0; m < superMethods.length; m++) {
|
||||||
var methodName = superMethods[m];
|
var superMethod = superMethods[m];
|
||||||
|
|
||||||
DecoratedClass.prototype[methodName] = SuperClass.prototype[methodName];
|
DecoratedClass.prototype[superMethod] =
|
||||||
|
SuperClass.prototype[methodName];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var m = 0; m < decoratedMethods.length; m++) {
|
var calledMethod = function (methodName) {
|
||||||
var methodName = decoratedMethods[m];
|
// Stub out the original method if it's not decorating an actual method
|
||||||
|
var originalMethod = function () {};
|
||||||
|
|
||||||
function calledMethod (methodName) {
|
if (methodName in DecoratedClass.prototype) {
|
||||||
// Stub out the original method if it's not decorating an actual method
|
originalMethod = DecoratedClass.prototype[methodName];
|
||||||
var originalMethod = function () {};
|
|
||||||
|
|
||||||
if (methodName in DecoratedClass.prototype) {
|
|
||||||
originalMethod = DecoratedClass.prototype[methodName];
|
|
||||||
}
|
|
||||||
|
|
||||||
var decoratedMethod = DecoratorClass.prototype[methodName];
|
|
||||||
|
|
||||||
return function () {
|
|
||||||
var unshift = Array.prototype.unshift;
|
|
||||||
|
|
||||||
unshift.call(arguments, originalMethod);
|
|
||||||
|
|
||||||
return decoratedMethod.apply(this, arguments);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DecoratedClass.prototype[methodName] = calledMethod(methodName);
|
var decoratedMethod = DecoratorClass.prototype[methodName];
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
var unshift = Array.prototype.unshift;
|
||||||
|
|
||||||
|
unshift.call(arguments, originalMethod);
|
||||||
|
|
||||||
|
return decoratedMethod.apply(this, arguments);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var d = 0; d < decoratedMethods.length; d++) {
|
||||||
|
var decoratedMethod = decoratedMethods[d];
|
||||||
|
|
||||||
|
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DecoratedClass;
|
return DecoratedClass;
|
||||||
}
|
};
|
||||||
|
|
||||||
var Observable = function () {
|
var Observable = function () {
|
||||||
this.listeners = {};
|
this.listeners = {};
|
||||||
@ -120,8 +121,8 @@ define([], function () {
|
|||||||
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("*" in this.listeners) {
|
if ('*' in this.listeners) {
|
||||||
this.invoke(this.listeners["*"], arguments);
|
this.invoke(this.listeners['*'], arguments);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user