lib/action/balance.js
function getCSSRanges(content, pos) {
		var rule;
		if (typeof content === 'string') {
			var ruleRange = cssSections.matchEnclosingRule(content, pos);
			if (ruleRange) {
				rule = cssEditTree.parse(ruleRange.substring(content), {
					offset: ruleRange.start
				});
			}
		} else {
			// passed parsed CSS rule
			rule = content;
		}

		if (!rule) {
			return null;
		}

		// find all possible ranges
		var ranges = rangesForCSSRule(rule, pos);

		// remove empty ranges
		ranges = ranges.filter(function(item) {
			return !!item.length;
		});

		return utils.unique(ranges, function(item) {
			return item.valueOf();
		});
	}
function getCSSRanges(content, pos) {
		var rule;
		if (typeof content === 'string') {
			var ruleRange = cssSections.matchEnclosingRule(content, pos);
			if (ruleRange) {
				rule = cssEditTree.parse(ruleRange.substring(content), {
					offset: ruleRange.start
				});
			}
		} else {
			// passed parsed CSS rule
			rule = content;
		}

		if (!rule) {
			return null;
		}

		// find all possible ranges
		var ranges = rangesForCSSRule(rule, pos);

		// remove empty ranges
		ranges = ranges.filter(function(item) {
			return !!item.length;
		});

		return utils.unique(ranges, function(item) {
			return item.valueOf();
		});
	}
function getCSSRanges ( content , pos ) { var rule ; if ( typeof content === 'string' ) { var ruleRange = cssSections . matchEnclosingRule ( content , pos ) ; if ( ruleRange ) { rule = cssEditTree . parse ( ruleRange . substring ( content ) , { offset : ruleRange . start } ) ; } } else { // passed parsed CSS rule rule = content ; } if ( ! rule ) { return null ; } // find all possible ranges var ranges = rangesForCSSRule ( rule , pos ) ; // remove empty ranges ranges = ranges . filter ( function ( item ) { return ! ! item . length ; } ) ; return utils . unique ( ranges , function ( item ) { return item . valueOf ( ) ; } ) ; }
Returns all possible selection ranges for given caret position
@param  {String} content CSS content
@param  {Number} pos     Caret position(where to start searching)
@return {Array}
Returns all possible selection ranges for given caret position