lib/filter/bem.js
function processClassName(name, item) {
		name = transformClassName(name, item, 'element');
		name = transformClassName(name, item, 'modifier');
		
		// expand class name
		// possible values:
		// * block__element
		// * block__element_modifier
		// * block__element_modifier1_modifier2
		// * block_modifier
		var block = '', element = '', modifier = '';
		var separators = getSeparators();
		if (~name.indexOf(separators.element)) {
			var elements = name.split(separators.element);
			block = elements.shift();

			var modifiers = elements.pop().split(separators.modifier);
			elements.push(modifiers.shift());
			element = elements.join(separators.element);
			modifier = modifiers.join(separators.modifier);
		} else if (~name.indexOf(separators.modifier)) {
			var blockModifiers = name.split(separators.modifier);
			
			block = blockModifiers.shift();
			modifier = blockModifiers.join(separators.modifier);
		}
		
		if (block || element || modifier) {
			if (!block) {
				block = item.__bem.block;
			}
			
			// inherit parent bem element, if exists
//			if (item.parent && item.parent.__bem && item.parent.__bem.element)
//				element = item.parent.__bem.element + separators.element + element;
			
			// produce multiple classes
			var prefix = block;
			var result = [];
			
			if (element) {
				prefix += separators.element + element;
				result.push(prefix);
			} else {
				result.push(prefix);
			}
			
			if (modifier) {
				result.push(prefix + separators.modifier + modifier);
			}
			
			if (!item.__bem.block || modifier) {
				item.__bem.block = block;
			}
			
			item.__bem.element = element;
			item.__bem.modifier = modifier;
			
			return result;
		}
		
		// ...otherwise, return processed or original class name
		return name;
	}
function processClassName(name, item) {
		name = transformClassName(name, item, 'element');
		name = transformClassName(name, item, 'modifier');
		
		// expand class name
		// possible values:
		// * block__element
		// * block__element_modifier
		// * block__element_modifier1_modifier2
		// * block_modifier
		var block = '', element = '', modifier = '';
		var separators = getSeparators();
		if (~name.indexOf(separators.element)) {
			var elements = name.split(separators.element);
			block = elements.shift();

			var modifiers = elements.pop().split(separators.modifier);
			elements.push(modifiers.shift());
			element = elements.join(separators.element);
			modifier = modifiers.join(separators.modifier);
		} else if (~name.indexOf(separators.modifier)) {
			var blockModifiers = name.split(separators.modifier);
			
			block = blockModifiers.shift();
			modifier = blockModifiers.join(separators.modifier);
		}
		
		if (block || element || modifier) {
			if (!block) {
				block = item.__bem.block;
			}
			
			// inherit parent bem element, if exists
//			if (item.parent && item.parent.__bem && item.parent.__bem.element)
//				element = item.parent.__bem.element + separators.element + element;
			
			// produce multiple classes
			var prefix = block;
			var result = [];
			
			if (element) {
				prefix += separators.element + element;
				result.push(prefix);
			} else {
				result.push(prefix);
			}
			
			if (modifier) {
				result.push(prefix + separators.modifier + modifier);
			}
			
			if (!item.__bem.block || modifier) {
				item.__bem.block = block;
			}
			
			item.__bem.element = element;
			item.__bem.modifier = modifier;
			
			return result;
		}
		
		// ...otherwise, return processed or original class name
		return name;
	}
function processClassName ( name , item ) { name = transformClassName ( name , item , 'element' ) ; name = transformClassName ( name , item , 'modifier' ) ; // expand class name // possible values: // * block__element // * block__element_modifier // * block__element_modifier1_modifier2 // * block_modifier var block = '' , element = '' , modifier = '' ; var separators = getSeparators ( ) ; if ( ~ name . indexOf ( separators . element ) ) { var elements = name . split ( separators . element ) ; block = elements . shift ( ) ; var modifiers = elements . pop ( ) . split ( separators . modifier ) ; elements . push ( modifiers . shift ( ) ) ; element = elements . join ( separators . element ) ; modifier = modifiers . join ( separators . modifier ) ; } else if ( ~ name . indexOf ( separators . modifier ) ) { var blockModifiers = name . split ( separators . modifier ) ; block = blockModifiers . shift ( ) ; modifier = blockModifiers . join ( separators . modifier ) ; } if ( block || element || modifier ) { if ( ! block ) { block = item . __bem . block ; } // inherit parent bem element, if exists //			if (item.parent && item.parent.__bem && item.parent.__bem.element) //				element = item.parent.__bem.element + separators.element + element; // produce multiple classes var prefix = block ; var result = [ ] ; if ( element ) { prefix += separators . element + element ; result . push ( prefix ) ; } else { result . push ( prefix ) ; } if ( modifier ) { result . push ( prefix + separators . modifier + modifier ) ; } if ( ! item . __bem . block || modifier ) { item . __bem . block = block ; } item . __bem . element = element ; item . __bem . modifier = modifier ; return result ; } // ...otherwise, return processed or original class name return name ; }
Processes class name
@param {String} name Class name item to process
@param {AbbreviationNode} item Host node for provided class name
@returns Processed class name. May return <code>Array</code> of
class names
Processes class name