From 606bfbfcbfee5b54b1ac9584cae1c551e95aa50e Mon Sep 17 00:00:00 2001 From: Alexej Yaroshevich Date: Fri, 26 Dec 2014 23:45:07 +0400 Subject: [PATCH] fixup code style errors --- .bem/techs/bemhtml.js | 4 +- common.blocks/i-bem-dom/i-bem-dom.js | 1 + .../_dummy/i-bem__i18n_dummy_yes.bemhtml | 2 +- .../i-bem/__i18n/i-bem__i18n.i18n/core.js | 1 + .../i-bem/__i18n/test/complex_test.js | 12 ++--- common.blocks/i-bem/i-bem.bemtree | 4 +- common.blocks/i-bem/i-bem.vanilla.js | 2 +- .../_type/jquery__event_type_pointernative.js | 46 +++++++++---------- .../simple.blocks/example/example.bemhtml | 4 +- .../__uri/querystring__uri.spec.js | 14 +++--- .../__uri/querystring__uri.vanilla.js | 4 +- common.blocks/querystring/querystring.spec.js | 2 +- desktop.blocks/page/page.bemhtml | 2 +- desktop.blocks/ua/ua.js | 2 +- 14 files changed, 51 insertions(+), 49 deletions(-) diff --git a/.bem/techs/bemhtml.js b/.bem/techs/bemhtml.js index 4f7a27422..8e3c107fe 100644 --- a/.bem/techs/bemhtml.js +++ b/.bem/techs/bemhtml.js @@ -20,7 +20,7 @@ exports.techMixin = { getBuildResultChunk : function(relPath, path, suffix) { var content = this.readContent(path, suffix); - return (suffix !== 'bemhtml.xjst' ? + return (suffix !== 'bemhtml.xjst'? content.then(function(source) { return compat.transpile(source); }) : content) .then(function(source) { @@ -61,7 +61,7 @@ exports.techMixin = { var tmpl = ['block(\'{{bemBlockName}}\')']; vars.ElemName && tmpl.push('.elem(\'{{bemElemName}}\')'); - vars.ModVal && tmpl.push('.' + (vars.ElemName ? 'elemMod' : 'mod') + '(\'{{bemModName}}\', \'{{bemModVal}}\')'); + vars.ModVal && tmpl.push('.' + (vars.ElemName? 'elemMod' : 'mod') + '(\'{{bemModName}}\', \'{{bemModVal}}\')'); return Template.process(tmpl.join(''), vars); } diff --git a/common.blocks/i-bem-dom/i-bem-dom.js b/common.blocks/i-bem-dom/i-bem-dom.js index 817387d14..1bfff8d7d 100644 --- a/common.blocks/i-bem-dom/i-bem-dom.js +++ b/common.blocks/i-bem-dom/i-bem-dom.js @@ -745,6 +745,7 @@ var Block = inherit(BEM.Block,/** @lends Block.prototype */{ /** * Filters results of findElem helper execution in strict mode + * @private * @param {jQuery} res DOM elements * @returns {jQuery} DOM elements */ diff --git a/common.blocks/i-bem/__i18n/_dummy/i-bem__i18n_dummy_yes.bemhtml b/common.blocks/i-bem/__i18n/_dummy/i-bem__i18n_dummy_yes.bemhtml index c3edaa59a..970a73270 100644 --- a/common.blocks/i-bem/__i18n/_dummy/i-bem__i18n_dummy_yes.bemhtml +++ b/common.blocks/i-bem/__i18n/_dummy/i-bem__i18n_dummy_yes.bemhtml @@ -21,5 +21,5 @@ oninit(function() { i18n.key = function(key) { return key; }; i18n.lang = function() { return; }; - })(this, typeof BEM === 'undefined' ? {} : BEM); + })(this, typeof BEM === 'undefined'? {} : BEM); }); diff --git a/common.blocks/i-bem/__i18n/i-bem__i18n.i18n/core.js b/common.blocks/i-bem/__i18n/i-bem__i18n.i18n/core.js index f3b1b270d..66af2f5ee 100644 --- a/common.blocks/i-bem/__i18n/i-bem__i18n.i18n/core.js +++ b/common.blocks/i-bem/__i18n/i-bem__i18n.i18n/core.js @@ -76,6 +76,7 @@ function _popStack() { /** * @constructor + * @protected */ function _i18n() { this._lang = ''; diff --git a/common.blocks/i-bem/__i18n/test/complex_test.js b/common.blocks/i-bem/__i18n/test/complex_test.js index ac2be17fa..2400263af 100644 --- a/common.blocks/i-bem/__i18n/test/complex_test.js +++ b/common.blocks/i-bem/__i18n/test/complex_test.js @@ -27,7 +27,7 @@ suite('BEM.I18N Complex tests', function() { return (lastNumber === 1 && lastNumbers !== 11)? params.one : ( (lastNumber > 1 && lastNumber < 5) && (lastNumbers < 10 || lastNumbers > 20)? - params.some : params.many ); + params.some : params.many); }).call(this, params); }, 'plural_adv' : function(params) { @@ -75,7 +75,7 @@ suite('BEM.I18N Complex tests', function() { 'one' : 'Найдена', 'some' : 'Найдено', 'many' : 'Найдено' - } ) + ' \n' + + }) + ' \n' + params['count'] + '\n' + this.keyset('i-tanker__dynamic').key('plural_adv', { 'count' : params['count'], @@ -90,10 +90,10 @@ suite('BEM.I18N Complex tests', function() { return this.keyset('i-tanker__dynamic').key('plural_adv', { 'count' : params['count'], 'none' : 'Ничего не найдено на страницах Помощи.', - 'one' : '

' + this.keyset('i-locale').key('not-found-in-section', { } ) + '

' + 'Найдена', - 'some' : '

' + this.keyset('i-locale').key('not-found-in-section', { } ) + '

' + 'Найдено', - 'many' : '

' + this.keyset('i-locale').key('not-found-in-section', { } ) + '

' + 'Найдено' - } ) + ' \n' + + 'one' : '

' + this.keyset('i-locale').key('not-found-in-section', { }) + '

' + 'Найдена', + 'some' : '

' + this.keyset('i-locale').key('not-found-in-section', { }) + '

' + 'Найдено', + 'many' : '

' + this.keyset('i-locale').key('not-found-in-section', { }) + '

' + 'Найдено' + }) + ' \n' + params['count'] + '\n' + this.keyset('i-tanker__dynamic').key('plural_adv', { 'count' : params['count'], diff --git a/common.blocks/i-bem/i-bem.bemtree b/common.blocks/i-bem/i-bem.bemtree index 91cb4bdfe..535213186 100644 --- a/common.blocks/i-bem/i-bem.bemtree +++ b/common.blocks/i-bem/i-bem.bemtree @@ -114,8 +114,8 @@ match(this._mode === '')( block = this._currBlock || this.block; return apply('default', { - block : vBlock || (vElem ? block : undefined), - _currBlock : (vBlock || vElem) ? undefined : block, + block : vBlock || (vElem? block : undefined), + _currBlock : (vBlock || vElem)? undefined : block, elem : vElem, mods : vBlock? this.ctx.mods || (this.ctx.mods = {}) : this.mods, elemMods : this.ctx.elemMods || {} diff --git a/common.blocks/i-bem/i-bem.vanilla.js b/common.blocks/i-bem/i-bem.vanilla.js index 3ea99399c..460e84417 100644 --- a/common.blocks/i-bem/i-bem.vanilla.js +++ b/common.blocks/i-bem/i-bem.vanilla.js @@ -312,7 +312,7 @@ var Block = inherit(events.Emitter, /** @lends Block.prototype */ { /** * Returns values of modifiers of the block/nested element * @param {Object} [elem] Nested element - * @param {String} [...modNames] Modifier names + * @param {...String} [modNames] Modifier names * @returns {Object} Hash of modifier values */ getMods : function(elem) { diff --git a/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.js b/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.js index 4125e67a1..9e88cc264 100644 --- a/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.js +++ b/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.js @@ -532,7 +532,7 @@ var touchEvents = { removePrimaryPointer : function(pointer) { if(pointer.isPrimary) { this.firstTouch = null; - //this.firstXY = null; + // this.firstXY = null; this.resetClickCount(); } }, @@ -602,7 +602,7 @@ var touchEvents = { // return "true" for things to be much easier return true; }, - + findTouch : function(touches, pointerId) { for(var i = 0, l = touches.length, t; i < l && (t = touches[i]); i++) { if(t.identifier === pointerId) { @@ -610,13 +610,13 @@ var touchEvents = { } } }, - + /** * In some instances, a touchstart can happen without a touchend. * This leaves the pointermap in a broken state. * Therefore, on every touchstart, we remove the touches * that did not fire a touchend event. - * + * * To keep state globally consistent, we fire a pointercancel * for this "abandoned" touch */ @@ -626,7 +626,7 @@ var touchEvents = { // been processed yet. if(pointermap.pointers() >= touches.length) { var d = []; - + pointermap.forEach(function(pointer, pointerId) { // Never remove pointerId == 1, which is mouse. // Touch identifiers are 2 smaller than their pointerId, which is the @@ -634,7 +634,7 @@ var touchEvents = { if(pointerId === MOUSE_POINTER_ID || this.findTouch(touches, pointerId - 2)) return; d.push(pointer.outEvent); }, this); - + d.forEach(this.cancelOut, this); } }, @@ -658,20 +658,20 @@ var touchEvents = { }, TOUCH_DEDUP_TIMEOUT); } }, - + touchstart : function(event) { var touchEvent = event.originalEvent; this.vacuumTouches(touchEvent); this.setPrimaryTouch(touchEvent.changedTouches[0]); this.dedupSynthMouse(touchEvent); - + if(!this.scrolling) { this.clickCount++; this.processTouches(event, this.overDown); } }, - + touchmove : function(event) { var touchEvent = event.originalEvent; if(!this.scrolling) { @@ -694,17 +694,17 @@ var touchEvents = { } } }, - + touchend : function(event) { var touchEvent = event.originalEvent; this.dedupSynthMouse(touchEvent); this.processTouches(event, this.upOut); }, - + touchcancel : function(event) { this.processTouches(event, this.cancelOut); }, - + overDown : function(pEvent) { var target = pEvent.target; pointermap.set(pEvent.pointerId, { @@ -781,15 +781,15 @@ var msEvents = { 'MSPointerOver', 'MSPointerCancel' ], - + register : function(target) { dispatcher.listen(target, this.events); }, - + unregister : function(target) { dispatcher.unlisten(target, this.events); }, - + POINTER_TYPES : [ '', 'unavailable', @@ -797,46 +797,46 @@ var msEvents = { 'pen', 'mouse' ], - + prepareEvent : function(event) { var e = cloneEvent(event); HAS_BITMAP_TYPE && (e.pointerType = this.POINTER_TYPES[event.pointerType]); return e; }, - + MSPointerDown : function(event) { pointermap.set(event.pointerId, event); var e = this.prepareEvent(event); dispatcher.down(e); }, - + MSPointerMove : function(event) { var e = this.prepareEvent(event); dispatcher.move(e); }, - + MSPointerUp : function(event) { var e = this.prepareEvent(event); dispatcher.up(e); this.cleanup(event.pointerId); }, - + MSPointerOut : function(event) { var e = this.prepareEvent(event); dispatcher.leaveOut(e); }, - + MSPointerOver : function(event) { var e = this.prepareEvent(event); dispatcher.enterOver(e); }, - + MSPointerCancel : function(event) { var e = this.prepareEvent(event); dispatcher.cancel(e); this.cleanup(event.pointerId); }, - + cleanup : function(id) { pointermap['delete'](id); } diff --git a/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.tests/simple.blocks/example/example.bemhtml b/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.tests/simple.blocks/example/example.bemhtml index 9d9d98f1e..b726377fe 100644 --- a/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.tests/simple.blocks/example/example.bemhtml +++ b/common.blocks/jquery/__event/_type/jquery__event_type_pointernative.tests/simple.blocks/example/example.bemhtml @@ -4,8 +4,8 @@ block('example').content()({ elem : 'inner1', content : { elem : 'inner2', - content: { - elem: 'inner3' + content : { + elem : 'inner3' } } } diff --git a/common.blocks/querystring/__uri/querystring__uri.spec.js b/common.blocks/querystring/__uri/querystring__uri.spec.js index ab3119718..a44d6a545 100644 --- a/common.blocks/querystring/__uri/querystring__uri.spec.js +++ b/common.blocks/querystring/__uri/querystring__uri.spec.js @@ -2,31 +2,31 @@ modules.define('spec', ['querystring__uri'], function(provide, qs) { describe('querystring__uri', function() { describe('decodeURIComponent()', function() { - + it('should be able to decode cp1251 encoded params', function() { qs.decodeURIComponent('%F2%E0%E1%EB%EE').should.be.eql('табло'); }); - + it('should not fall on params encoded with unknown encoding', function() { qs.decodeURIComponent('%COCO%C0C0').should.be.eql('%COCO%C0C0'); }); - + }); - + describe('decodeURI()', function() { - + it('should be able to decode url with cp1251 encoded params', function() { qs .decodeURI('http://test.com/ololo/trololo.html?text=%F2%E0%E1%EB%EE') .should.be.eql('http://test.com/ololo/trololo.html?text=табло'); }); - + it('should not fall on url with params encoded with unknown encoding', function() { qs .decodeURI('http://test.com/ololo/trololo.html?text=%COCO%C0C0') .should.be.eql('http://test.com/ololo/trololo.html?text=%COCO%C0C0'); }); - + }); }); diff --git a/common.blocks/querystring/__uri/querystring__uri.vanilla.js b/common.blocks/querystring/__uri/querystring__uri.vanilla.js index ee845a43a..280b6a495 100644 --- a/common.blocks/querystring/__uri/querystring__uri.vanilla.js +++ b/common.blocks/querystring/__uri/querystring__uri.vanilla.js @@ -19,7 +19,7 @@ function convert(str) { function decode(fn, str) { var decoded = ''; - + // Try/catch block for getting the encoding of the source string. // Error is thrown if a non-UTF8 string is input. // If the string was not decoded, it is returned without changes. @@ -32,7 +32,7 @@ function decode(fn, str) { decoded = str; } } - + return decoded; } diff --git a/common.blocks/querystring/querystring.spec.js b/common.blocks/querystring/querystring.spec.js index 14e1b25f2..459d71058 100644 --- a/common.blocks/querystring/querystring.spec.js +++ b/common.blocks/querystring/querystring.spec.js @@ -65,7 +65,7 @@ describe('querystring', function() { { str : 'foo=1&bar=2', obj : { 'foo' : '1', 'bar' : '2' } }, { str : 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', - obj : { 'my weird field' : "q1!2\"'w$5&7/z8)?" } + obj : { 'my weird field' : 'q1!2"\'w$5&7/z8)?' } }, { str : 'foo%3Dbaz=bar', obj : { 'foo=baz' : 'bar' } }, { str : 'foo=bar&bar=baz', obj : { foo : 'bar', bar : 'baz' } }, diff --git a/desktop.blocks/page/page.bemhtml b/desktop.blocks/page/page.bemhtml index 328dd4d9c..d6a385c58 100644 --- a/desktop.blocks/page/page.bemhtml +++ b/desktop.blocks/page/page.bemhtml @@ -2,7 +2,7 @@ block('page')( elem('head')( content()(function() { return [ - this.ctx['x-ua-compatible'] === false ? + this.ctx['x-ua-compatible'] === false? false : { tag : 'meta', diff --git a/desktop.blocks/ua/ua.js b/desktop.blocks/ua/ua.js index b8fbc90e4..67c4b8e00 100644 --- a/desktop.blocks/ua/ua.js +++ b/desktop.blocks/ua/ua.js @@ -1,4 +1,4 @@ -/** +/** * @module ua * @description Detect some user agent features (works like jQuery.browser in jQuery 1.8) * @see http://code.jquery.com/jquery-migrate-1.1.1.js