vendor/emmet.js
function makePossibleRangesCSS(property) {
		// find all possible ranges, sorted by position and size
		var valueRange = property.valueRange(true);
		var result = [property.range(true), valueRange];
		var stringStream = require('stringStream');
		var cssEditTree = require('cssEditTree');
		var range = require('range');
		
		// locate parts of complex values.
		// some examples:
		// – 1px solid red: 3 parts
		// – arial, sans-serif: enumeration, 2 parts
		// – url(image.png): function value part
		var value = property.value();
		_.each(property.valueParts(), function(r) {
			// add absolute range
			var clone = r.clone();
			result.push(clone.shift(valueRange.start));
			
			/** @type StringStream */
			var stream = stringStream.create(r.substring(value));
			if (stream.match(/^[\w\-]+\(/, true)) {
				// we have a function, find values in it.
				// but first add function contents
				stream.start = stream.pos;
				stream.skipToPair('(', ')');
				var fnBody = stream.current();
				result.push(range.create(clone.start + stream.start, fnBody));
				
				// find parts
				_.each(cssEditTree.findParts(fnBody), function(part) {
					result.push(range.create(clone.start + stream.start + part.start, part.substring(fnBody)));
				});
			}
		});
		
		// optimize result: remove empty ranges and duplicates
		return _.chain(result)
			.filter(function(item) {
				return !!item.length();
			})
			.uniq(false, function(item) {
				return item.toString();
			})
			.value();
	}
function makePossibleRangesCSS(property) {
		// find all possible ranges, sorted by position and size
		var valueRange = property.valueRange(true);
		var result = [property.range(true), valueRange];
		var stringStream = require('stringStream');
		var cssEditTree = require('cssEditTree');
		var range = require('range');
		
		// locate parts of complex values.
		// some examples:
		// – 1px solid red: 3 parts
		// – arial, sans-serif: enumeration, 2 parts
		// – url(image.png): function value part
		var value = property.value();
		_.each(property.valueParts(), function(r) {
			// add absolute range
			var clone = r.clone();
			result.push(clone.shift(valueRange.start));
			
			/** @type StringStream */
			var stream = stringStream.create(r.substring(value));
			if (stream.match(/^[\w\-]+\(/, true)) {
				// we have a function, find values in it.
				// but first add function contents
				stream.start = stream.pos;
				stream.skipToPair('(', ')');
				var fnBody = stream.current();
				result.push(range.create(clone.start + stream.start, fnBody));
				
				// find parts
				_.each(cssEditTree.findParts(fnBody), function(part) {
					result.push(range.create(clone.start + stream.start + part.start, part.substring(fnBody)));
				});
			}
		});
		
		// optimize result: remove empty ranges and duplicates
		return _.chain(result)
			.filter(function(item) {
				return !!item.length();
			})
			.uniq(false, function(item) {
				return item.toString();
			})
			.value();
	}
function makePossibleRangesCSS ( property ) { // find all possible ranges, sorted by position and size var valueRange = property . valueRange ( true ) ; var result = [ property . range ( true ) , valueRange ] ; var stringStream = require ( 'stringStream' ) ; var cssEditTree = require ( 'cssEditTree' ) ; var range = require ( 'range' ) ; // locate parts of complex values. // some examples: // – 1px solid red: 3 parts // – arial, sans-serif: enumeration, 2 parts // – url(image.png): function value part var value = property . value ( ) ; _ . each ( property . valueParts ( ) , function ( r ) { // add absolute range var clone = r . clone ( ) ; result . push ( clone . shift ( valueRange . start ) ) ; /** @type StringStream */ var stream = stringStream . create ( r . substring ( value ) ) ; if ( stream . match ( / ^[\w\-]+\( / , true ) ) { // we have a function, find values in it. // but first add function contents stream . start = stream . pos ; stream . skipToPair ( '(' , ')' ) ; var fnBody = stream . current ( ) ; result . push ( range . create ( clone . start + stream . start , fnBody ) ) ; // find parts _ . each ( cssEditTree . findParts ( fnBody ) , function ( part ) { result . push ( range . create ( clone . start + stream . start + part . start , part . substring ( fnBody ) ) ) ; } ) ; } } ) ; // optimize result: remove empty ranges and duplicates return _ . chain ( result ) . filter ( function ( item ) { return ! ! item . length ( ) ; } ) . uniq ( false , function ( item ) { return item . toString ( ) ; } ) . value ( ) ; }
Makes all possible selection ranges for specified CSS property
@param {CSSProperty} property
@returns {Array}
Makes all possible selection ranges for specified CSS property