Sha256: d33acbd4fef460f7be24348a57085e4b90fe43d65bf8ba9da409656b4a851a57
Contents?: true
Size: 1.34 KB
Versions: 6
Compression:
Stored size: 1.34 KB
Contents
// Checks if instance exists in selector familiy tree, falls back from current selector // ------------------------------------------------------------------------------- // @dependence `selector_string()` // @dependence `string-to-list()` // @dependence `list-to-string()` // @dependence `get-value()` // @dependence `exists()` // @dependence `remove()` // ------------------------------------------------------------------------------- // @param $key [Breakpoint] : breakpoint key to search for matching instance // ------------------------------------------------------------------------------- // @return [Selectors] | false @function get-family-instance($key: get-value(settings, default)) { $selector-string: selector_string(); $selector-list: string-to-list($selector-string); $length: length($selector-list); // Loop through length of list of selectors @for $i from 1 through $length { // Make sure that we're not counting the current selector string @if exists($flint__instances, "#{list-to-string($selector-list, " ")}::#{$key}") and $selector-string != list-to-string($selector-list, " ") { // If true, return the matching instance key @return "#{list-to-string($selector-list, " ")}::#{$key}"; } @else { // Else, remove the last selector and loop again $selector-list: remove($selector-list, last($selector-list)); } } @return false; }
Version data entries
6 entries across 6 versions & 1 rubygems