Class: Selector

Selector~ Selector

new Selector(selectoropt)

Модуль работы с БЭМ-селектором.
Parameters:
Name Type Attributes Description
selector string <optional>
БЭМ-селектор
Source:

Members

(static) any :string

Символ любого значения.
Type:
  • string
Source:

(static) delimiters :Object

Разделители имён.
Type:
  • Object
Properties:
Name Type Description
mod string Разделитель блока и модификатора, элемента и модификатора, модификатора и значения
elem string Разделитель блока и элемента
Source:

Methods

block(nameopt) → {string|Selector}

Получить/установить имя блока.
Parameters:
Name Type Attributes Description
name string <optional>
Имя блока
Source:
Returns:
Type
string | Selector

elem(nameopt) → {string|Selector}

Получить/установить элемент.
Parameters:
Name Type Attributes Description
name string <optional>
Имя элемента
Source:
Returns:
Type
string | Selector

elemMod(nameopt, valopt) → {Object|Selector}

Получить/установить модификатор элемента.
Parameters:
Name Type Attributes Description
name string <optional>
Имя модификатора
val string | boolean <optional>
Значение модификатора
Source:
Returns:
Type
Object | Selector

elemModName(nameopt) → {string|Selector}

Получить/установить имя модификатора элемента.
Parameters:
Name Type Attributes Description
name string <optional>
Имя модификатора
Source:
Returns:
Type
string | Selector

elemModVal(valopt) → {string|Selector}

Получить/установить значение модификатора элемента.
Parameters:
Name Type Attributes Description
val string | boolean <optional>
Значение модификатора
Source:
Returns:
Type
string | Selector

info() → {object}

Получить информацию по БЭМ-сущности.
Source:
Returns:
Type
object

isBlock() → {boolean}

Проверить сущность на блок.
Source:
Returns:
Type
boolean

isElem() → {boolean}

Проверить сущность на элемент.
Source:
Returns:
Type
boolean

mod(nameopt, valopt) → {Object|Selector}

Получить/установить модификатор блока.
Parameters:
Name Type Attributes Description
name string <optional>
Имя модификатора
val string | boolean <optional>
Значение модификатора
Source:
Returns:
Type
Object | Selector

modName(nameopt) → {string|Selector}

Получить/установить имя модификатора блока.
Parameters:
Name Type Attributes Description
name string <optional>
Имя модификатора
Source:
Returns:
Type
string | Selector

modVal(valopt) → {string|Selector}

Получить/установить значение модификатора блока.
Parameters:
Name Type Attributes Description
val string | boolean <optional>
Значение модификатора
Source:
Returns:
Type
string | Selector

toString() → {string}

Получить строковое представление БЭМ-сущности.
Source:
Returns:
Type
string

weight(weightopt) → {number|Selector}

Получить/установить вес селектора.
Parameters:
Name Type Attributes Description
weight number <optional>
Вес селектора
Source:
Returns:
Type
number | Selector