lib/editTree/css.js
function(name, value, pos) {
			var list = this.list();
			var start = this._positions.contentStart;
			var styles = utils.pick(this.options, 'styleBefore', 'styleSeparator');
			
			if (typeof pos === 'undefined') {
				pos = list.length;
			}
			
			/** @type CSSEditProperty */
			var donor = list[pos];
			if (donor) {
				start = donor.fullRange().start;
			} else if ((donor = list[pos - 1])) {
				// make sure that donor has terminating semicolon
				donor.end(';');
				start = donor.range().end;
			}
			
			if (donor) {
				styles = utils.pick(donor, 'styleBefore', 'styleSeparator');
			}
			
			var nameToken = editTree.createToken(start + styles.styleBefore.length, name);
			var valueToken = editTree.createToken(nameToken.end + styles.styleSeparator.length, value);
			
			var property = new CSSEditElement(this, nameToken, valueToken,
					editTree.createToken(valueToken.end, ';'));
			
			utils.extend(property, styles);
			
			// write new property into the source
			this._updateSource(property.styleBefore + property.toString(), start);
			
			// insert new property
			this._children.splice(pos, 0, property);
			return property;
		}
function(name, value, pos) {
			var list = this.list();
			var start = this._positions.contentStart;
			var styles = utils.pick(this.options, 'styleBefore', 'styleSeparator');
			
			if (typeof pos === 'undefined') {
				pos = list.length;
			}
			
			/** @type CSSEditProperty */
			var donor = list[pos];
			if (donor) {
				start = donor.fullRange().start;
			} else if ((donor = list[pos - 1])) {
				// make sure that donor has terminating semicolon
				donor.end(';');
				start = donor.range().end;
			}
			
			if (donor) {
				styles = utils.pick(donor, 'styleBefore', 'styleSeparator');
			}
			
			var nameToken = editTree.createToken(start + styles.styleBefore.length, name);
			var valueToken = editTree.createToken(nameToken.end + styles.styleSeparator.length, value);
			
			var property = new CSSEditElement(this, nameToken, valueToken,
					editTree.createToken(valueToken.end, ';'));
			
			utils.extend(property, styles);
			
			// write new property into the source
			this._updateSource(property.styleBefore + property.toString(), start);
			
			// insert new property
			this._children.splice(pos, 0, property);
			return property;
		}
function ( name , value , pos ) { var list = this . list ( ) ; var start = this . _positions . contentStart ; var styles = utils . pick ( this . options , 'styleBefore' , 'styleSeparator' ) ; if ( typeof pos === 'undefined' ) { pos = list . length ; } /** @type CSSEditProperty */ var donor = list [ pos ] ; if ( donor ) { start = donor . fullRange ( ) . start ; } else if ( ( donor = list [ pos - 1 ] ) ) { // make sure that donor has terminating semicolon donor . end ( ';' ) ; start = donor . range ( ) . end ; } if ( donor ) { styles = utils . pick ( donor , 'styleBefore' , 'styleSeparator' ) ; } var nameToken = editTree . createToken ( start + styles . styleBefore . length , name ) ; var valueToken = editTree . createToken ( nameToken . end + styles . styleSeparator . length , value ) ; var property = new CSSEditElement ( this , nameToken , valueToken , editTree . createToken ( valueToken . end , ';' ) ) ; utils . extend ( property , styles ) ; // write new property into the source this . _updateSource ( property . styleBefore + property . toString ( ) , start ) ; // insert new property this . _children . splice ( pos , 0 , property ) ; return property ; }
Adds new CSS property
@param {String} name Property name
@param {String} value Property value
@param {Number} pos Position at which to insert new property. By
default the property is inserted at the end of rule
@returns {CSSEditProperty}
Adds new CSS property