diff --git a/.eslintrc b/.eslintrc index 7af1be5..9703fa9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,12 +14,15 @@ "CKEDITOR": true }, "rules": { + // Errors. "block-scoped-var": 2, - "brace-style": [2, "stroustrup", { "allowSingleLine": true }], + "brace-style": [2, "stroustrup", {"allowSingleLine": true}], "comma-style": [2, "last"], "eqeqeq": [2, "smart"], "guard-for-in": 2, + "key-spacing": [2, {"beforeColon": false, "afterColon": true}], "no-mixed-spaces-and-tabs": 2, + "no-nested-ternary": 2, "no-reserved-keys": 2, "no-trailing-spaces": 2, "no-undef": 2, @@ -29,6 +32,9 @@ "space-after-keywords": [2, "always", {"checkFunctionKeyword": true}], "spaced-line-comment": [2, "always"], "strict": 2, + // Warnings. + "max-nested-callbacks": [1, 3], + // Disabled. "new-cap": 0, "quotes": 0, "camelcase": 0, diff --git a/core/misc/states.js b/core/misc/states.js index 6ad6029..abac1da 100644 --- a/core/misc/states.js +++ b/core/misc/states.js @@ -561,7 +561,15 @@ * Bitwise AND with a third undefined state. */ function ternary(a, b) { - return typeof a === 'undefined' ? b : (typeof b === 'undefined' ? a : a && b); + if (typeof a === 'undefined') { + return b; + } + else if (typeof b === 'undefined') { + return a; + } + else { + return a && b; + } } /** @@ -575,7 +583,12 @@ * Compares two values while ignoring undefined values. */ function compare(a, b) { - return (a === b) ? (typeof a === 'undefined' ? a : true) : (typeof a === 'undefined' || typeof b === 'undefined'); + if (a === b) { + return typeof a === 'undefined' ? a : true; + } + else { + return typeof a === 'undefined' || typeof b === 'undefined'; + } } })(jQuery); diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js index d984552..bb310bc 100644 --- a/core/misc/tabledrag.js +++ b/core/misc/tabledrag.js @@ -890,7 +890,13 @@ var b = document.body; var windowHeight = this.windowHeight = window.innerHeight || (de.clientHeight && de.clientWidth !== 0 ? de.clientHeight : b.offsetHeight); - var scrollY = this.scrollY = (document.all ? (!de.scrollTop ? b.scrollTop : de.scrollTop) : (window.pageYOffset ? window.pageYOffset : window.scrollY)); + var scrollY; + if (document.all) { + scrollY = this.scrollY = !de.scrollTop ? b.scrollTop : de.scrollTop; + } + else { + scrollY = this.scrollY = window.pageYOffset ? window.pageYOffset : window.scrollY; + } var trigger = this.scrollSettings.trigger; var delta = 0;