File tree Expand file tree Collapse file tree 4 files changed +22
-8
lines changed
Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 44 * changed default ` options.position ` value to ` true `
55 * remove comments from properties and values
66 * asserts when selectors are missing
7+ * added ` node.position.content ` property
78
891.7.0 / 2013-12-21
910==================
Original file line number Diff line number Diff line change @@ -144,8 +144,9 @@ parse tree with `.position` enabled:
144144}
145145```
146146
147- If you also pass in ` source: 'path/to/original.css' ` , that will be set
148- on ` node.position.source ` .
147+ ` node.position.content ` is set on each node to the full source string. If you
148+ also pass in ` source: 'path/to/original.css' ` , that will be set on
149+ ` node.position.source ` .
149150
150151## Performance
151152
Original file line number Diff line number Diff line change @@ -33,17 +33,28 @@ module.exports = function(css, options){
3333 if ( ! options . position ) return positionNoop ;
3434
3535 return function ( node ) {
36- node . position = {
37- start : start ,
38- end : { line : lineno , column : column } ,
39- source : options . source
40- } ;
41-
36+ node . position = new Position ( start ) ;
4237 whitespace ( ) ;
4338 return node ;
4439 } ;
4540 }
4641
42+ /**
43+ * Store position information for a node
44+ */
45+
46+ function Position ( start ) {
47+ this . start = start ;
48+ this . end = { line : lineno , column : column } ;
49+ this . source = options . source ;
50+ }
51+
52+ /**
53+ * Non-enumerable source string
54+ */
55+
56+ Position . prototype . content = css ;
57+
4758 /**
4859 * Return `node`.
4960 */
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ describe('parse(str)', function(){
3333 position . start . should . be . ok ;
3434 position . end . should . be . ok ;
3535 position . source . should . equal ( 'booty.css' ) ;
36+ position . content . should . equal ( css ) ;
3637 } ) ;
3738
3839 it ( 'should throw when a selector is missing' , function ( ) {
You can’t perform that action at this time.
0 commit comments