File tree 4 files changed +22
-8
lines changed
4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 4
4
* changed default ` options.position ` value to ` true `
5
5
* remove comments from properties and values
6
6
* asserts when selectors are missing
7
+ * added ` node.position.content ` property
7
8
8
9
1.7.0 / 2013-12-21
9
10
==================
Original file line number Diff line number Diff line change @@ -144,8 +144,9 @@ parse tree with `.position` enabled:
144
144
}
145
145
```
146
146
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 ` .
149
150
150
151
## Performance
151
152
Original file line number Diff line number Diff line change @@ -33,17 +33,28 @@ module.exports = function(css, options){
33
33
if ( ! options . position ) return positionNoop ;
34
34
35
35
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 ) ;
42
37
whitespace ( ) ;
43
38
return node ;
44
39
} ;
45
40
}
46
41
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
+
47
58
/**
48
59
* Return `node`.
49
60
*/
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ describe('parse(str)', function(){
33
33
position . start . should . be . ok ;
34
34
position . end . should . be . ok ;
35
35
position . source . should . equal ( 'booty.css' ) ;
36
+ position . content . should . equal ( css ) ;
36
37
} ) ;
37
38
38
39
it ( 'should throw when a selector is missing' , function ( ) {
You can’t perform that action at this time.
0 commit comments