Sha256: 05afea3a9fcabc5ac334c444b5f26b2bb4de4fe37613514efce9992cb2bf29b9

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

// ----------------------------------------------------------------------
// Element modifier
// ----------------------------------------------------------------------

/// Scopes the @content ruleset to an element of the block being modified
/// @private
/// @param {String | Arglist} $modified-elements - List of elements that should be modified
/// @returns The final selector for the element(s) modified by the block modifier

@function _modifies-element($modified-elements...) {

    $inside-check: should-be-called-within('modifier', 'state');
    $outside-check: should-not-be-called-within('element');

    $selectors: ();

    @each $element in $modified-elements {
        $element: map-get(map-get($_bem-current-context, 'block'), 'selector') + $bem-element-separator + $element;
        $selectors: append($selectors, $element, 'comma');
    }

    $selector: selector-nest(&, $selectors);

    $set-current: set-current-context('modifies-element', $modified-elements, $selector);

    @return $selector;
}


/// Scopes the @content ruleset to an element of the block being modified
/// @param {String | Arglist} $modified-elements - Name of the element(s) that should be modified

@mixin modifies-element($modified-elements...) {
    @at-root #{_modifies-element($modified-elements...)} {
        @content;
    }

    $unset-current: unset-current-context('modifies-element');
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bem-constructor-0.3.0 stylesheets/_modifies-element.scss
bem-constructor-0.2.0 stylesheets/_modifies-element.scss