lib/editTree/css.js
function findParts(str) {
		/** @type StringStream */
		var stream = stringStream.create(str);
		var ch;
		var result = [];
		var sep = /[\s\u00a0,;]/;
		
		var add = function() {
			stream.next();
			result.push(range(stream.start, stream.current()));
			stream.start = stream.pos;
		};
		
		// skip whitespace
		stream.eatSpace();
		stream.start = stream.pos;
		
		while ((ch = stream.next())) {
			if (ch == '"' || ch == "'") {
				stream.next();
				if (!stream.skipTo(ch)) break;
				add();
			} else if (ch == '(') {
				// function found, may have nested function
				stream.backUp(1);
				if (!stream.skipToPair('(', ')')) break;
				stream.backUp(1);
				add();
			} else {
				if (sep.test(ch)) {
					result.push(range(stream.start, stream.current().length - 1));
					stream.eatWhile(sep);
					stream.start = stream.pos;
				}
			}
		}
		
		add();

		return utils.unique(result.filter(function(item) {
			return !!item.length();
		}));
	}
function findParts(str) {
		/** @type StringStream */
		var stream = stringStream.create(str);
		var ch;
		var result = [];
		var sep = /[\s\u00a0,;]/;
		
		var add = function() {
			stream.next();
			result.push(range(stream.start, stream.current()));
			stream.start = stream.pos;
		};
		
		// skip whitespace
		stream.eatSpace();
		stream.start = stream.pos;
		
		while ((ch = stream.next())) {
			if (ch == '"' || ch == "'") {
				stream.next();
				if (!stream.skipTo(ch)) break;
				add();
			} else if (ch == '(') {
				// function found, may have nested function
				stream.backUp(1);
				if (!stream.skipToPair('(', ')')) break;
				stream.backUp(1);
				add();
			} else {
				if (sep.test(ch)) {
					result.push(range(stream.start, stream.current().length - 1));
					stream.eatWhile(sep);
					stream.start = stream.pos;
				}
			}
		}
		
		add();

		return utils.unique(result.filter(function(item) {
			return !!item.length();
		}));
	}
function findParts ( str ) { /** @type StringStream */ var stream = stringStream . create ( str ) ; var ch ; var result = [ ] ; var sep = / [\s\u00a0,;] / ; var add = function ( ) { stream . next ( ) ; result . push ( range ( stream . start , stream . current ( ) ) ) ; stream . start = stream . pos ; } ; // skip whitespace stream . eatSpace ( ) ; stream . start = stream . pos ; while ( ( ch = stream . next ( ) ) ) { if ( ch == '"' || ch == "'" ) { stream . next ( ) ; if ( ! stream . skipTo ( ch ) ) break ; add ( ) ; } else if ( ch == '(' ) { // function found, may have nested function stream . backUp ( 1 ) ; if ( ! stream . skipToPair ( '(' , ')' ) ) break ; stream . backUp ( 1 ) ; add ( ) ; } else { if ( sep . test ( ch ) ) { result . push ( range ( stream . start , stream . current ( ) . length - 1 ) ) ; stream . eatWhile ( sep ) ; stream . start = stream . pos ; } } } add ( ) ; return utils . unique ( result . filter ( function ( item ) { return ! ! item . length ( ) ; } ) ) ; }
Finds parts of complex CSS value
@param {String} str
@returns {Array} Returns list of <code>Range</code>'s
Finds parts of complex CSS value