Sha256: 64cafbee784c6d7f97c53235c46de85c8f6bf51ed1e01ddf31b2344201d658ed

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 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-element...) {

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

    $selectors: ();

    @each $element in $modified-element {
        $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-element, $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;
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bem-constructor-0.1.1 stylesheets/_modifies-element.scss
bem-constructor-0.1 stylesheets/_modifies-element.scss