Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions blocks-common/i-bem/__dom/_init/i-bem__dom_init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Implementation from bem-core#2.5.0

/**
* @module i-bem__dom_init
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These style @module comments are not used in bem-bl

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found usage of @module comments in bem-bl:

./blocks-common/i-jquery/__debounce/i-jquery__debounce.js: * @module i-jquery__debounce
./blocks-common/i-jquery/__decodeuri/i-jquery__decodeuri.js: * @module i-jquery__decodeuri
./blocks-common/i-jquery/__observable/i-jquery__observable.js: * @module i-jquery__observable
./blocks-common/i-geolocation/i-geolocation.js: * @module i-geolocation
./blocks-common/i-ecma/__json/i-ecma__json.js: * @module i-ecma__json
./blocks-common/i-ecma/__function/i-ecma__function.js: * @module i-ecma__function
./blocks-common/i-ecma/__string/i-ecma__string.js: * @module i-ecma__trim
./blocks-common/i-ecma/__object/i-ecma__object.js: * @module i-ecma__object
./blocks-common/i-ecma/__array/i-ecma__array.js: * @module i-ecma__array
./blocks-common/i-menu/i-menu.js: * @module i-menu
./blocks-common/i-bem/i-bem.js: * @module i-bem
./blocks-common/i-bem/__internal/i-bem__internal.js: * @module  i-bem__internal
./blocks-common/i-bem/__dom/_init/i-bem__dom_init.js: * @module i-bem__dom_init
./blocks-common/i-bem/__dom/i-bem__dom.js: * @module i-bem__dom
./blocks-common/b-menu-vert/__trigger/b-menu-vert__trigger.js: * @module b-menu-vert
./blocks-common/i-system/i-system.js: * @module i-system


(typeof modules === 'object') && modules.define('i-bem__dom_init', ['i-bem__dom'], function(provide, BEMDOM) {

provide(
/**
* Initializes blocks on a fragment of the DOM tree
* @exports
* @param {jQuery} [ctx=scope] Root DOM node
* @returns {jQuery} ctx Initialization context
*/
function(ctx) {
return BEMDOM.init(ctx);
});
});
5 changes: 5 additions & 0 deletions blocks-common/i-bem/__dom/_init/i-bem__dom_init_auto.deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
({
shouldDeps : [
{ mod : 'init' }
]
})
23 changes: 18 additions & 5 deletions blocks-common/i-bem/__dom/_init/i-bem__dom_init_auto.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/* дефолтная инициализация */
$(function() {
BEM.afterCurrentEvent(function() {
BEM.DOM.init();
/**
* Auto initialization on DOM ready
*/

// Support for YModules
if (typeof modules === 'object') {
// Implementation from bem-core#2.5.0
modules.require(['i-bem__dom_init'], function(init) {
$(function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One level of padding is missed here

BEM.afterCurrentEvent(init);
});
});
});
} else {
$(function() {
BEM.afterCurrentEvent(function() {
BEM.DOM.init();
});
});
}
27 changes: 27 additions & 0 deletions blocks-common/i-bem/__dom/i-bem__dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1715,3 +1715,30 @@ $(function() {
});

})(BEM, jQuery);


/**
* Support for YModules
*/
if (typeof modules === 'object') {

modules.define('i-bem__dom', function(provide) {
provide(BEM.DOM);
});

// Implementation from bem-core#2.5.0
(function() {
var origDefine = modules.define;

modules.define = function(name, deps, decl) {
origDefine.apply(modules, arguments);

if (name !== 'i-bem__dom_init' && arguments.length > 2 && ~deps.indexOf('i-bem__dom')) {
modules.define('i-bem__dom_init', [name], function(provide, _, prev) {
provide(prev);
});
}
};
})();

}