@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
THE SOFTWARE.
22
22
23
23
*/
24
- /* Version v0.1.9 , Build time: 23-July -2012 10:52:31 */
24
+ /* Version v0.2.0 , Build time: 13-November -2012 01:17:54 */
25
25
var parserlib = { } ;
26
26
( function ( ) {
27
27
@@ -908,7 +908,7 @@ TokenStreamBase : TokenStreamBase
908
908
} ) ( ) ;
909
909
910
910
911
- /*
911
+ /*
912
912
Parser-Lib
913
913
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
914
914
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931
931
THE SOFTWARE.
932
932
933
933
*/
934
- /* Version v0.1.9 , Build time: 23-July -2012 10:52:31 */
934
+ /* Version v0.2.0 , Build time: 13-November -2012 01:17:54 */
935
935
( function ( ) {
936
936
var EventTarget = parserlib . util . EventTarget ,
937
937
TokenStreamBase = parserlib . util . TokenStreamBase ,
@@ -2145,7 +2145,7 @@ Parser.prototype = function(){
2145
2145
2146
2146
//there must be a next selector
2147
2147
if ( nextSelector === null ) {
2148
- this . _unexpectedToken ( this . LT ( 1 ) ) ;
2148
+ this . _unexpectedToken ( tokenStream . LT ( 1 ) ) ;
2149
2149
} else {
2150
2150
2151
2151
//nextSelector is an instance of SelectorPart
@@ -3597,7 +3597,7 @@ var Properties = {
3597
3597
valid = ValidationTypes . isAny ( expression , numeric ) ;
3598
3598
if ( ! valid ) {
3599
3599
3600
- if ( expression . peek ( ) == "/" && count > 1 && ! slash ) {
3600
+ if ( expression . peek ( ) == "/" && count > 0 && ! slash ) {
3601
3601
slash = true ;
3602
3602
max = count + 5 ;
3603
3603
expression . next ( ) ;
@@ -5980,7 +5980,7 @@ var ValidationTypes = {
5980
5980
} ,
5981
5981
5982
5982
/**
5983
- * Determines if the next part(s) of the given expresion
5983
+ * Determines if the next part(s) of the given expression
5984
5984
* are one of a group.
5985
5985
*/
5986
5986
isAnyOfGroup : function ( expression , types ) {
@@ -6127,10 +6127,16 @@ var ValidationTypes = {
6127
6127
var types = this ,
6128
6128
result = false ,
6129
6129
numeric = "<percentage> | <length>" ,
6130
- xDir = "left | center | right" ,
6131
- yDir = "top | center | bottom" ,
6132
- part ,
6133
- i , len ;
6130
+ xDir = "left | right" ,
6131
+ yDir = "top | bottom" ,
6132
+ count = 0 ,
6133
+ hasNext = function ( ) {
6134
+ return expression . hasNext ( ) && expression . peek ( ) != "," ;
6135
+ } ;
6136
+
6137
+ while ( expression . peek ( count ) && expression . peek ( count ) != "," ) {
6138
+ count ++ ;
6139
+ }
6134
6140
6135
6141
/*
6136
6142
<position> = [
@@ -6142,40 +6148,48 @@ var ValidationTypes = {
6142
6148
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
6143
6149
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
6144
6150
]
6151
+ */
6145
6152
6146
- */
6147
-
6148
- if ( ValidationTypes . isAny ( expression , "top | bottom" ) ) {
6149
- result = true ;
6153
+ if ( count < 3 ) {
6154
+ if ( ValidationTypes . isAny ( expression , xDir + " | center | " + numeric ) ) {
6155
+ result = true ;
6156
+ ValidationTypes . isAny ( expression , yDir + " | center | " + numeric ) ;
6157
+ } else if ( ValidationTypes . isAny ( expression , yDir ) ) {
6158
+ result = true ;
6159
+ ValidationTypes . isAny ( expression , xDir + " | center" ) ;
6160
+ }
6150
6161
} else {
6151
-
6152
- //must be two-part
6153
- if ( ValidationTypes . isAny ( expression , numeric ) ) {
6154
- if ( expression . hasNext ( ) ) {
6155
- result = ValidationTypes . isAny ( expression , numeric + " | " + yDir ) ;
6156
- }
6157
- } else if ( ValidationTypes . isAny ( expression , xDir ) ) {
6158
- if ( expression . hasNext ( ) ) {
6159
-
6160
- //two- or three-part
6161
- if ( ValidationTypes . isAny ( expression , yDir ) ) {
6162
+ if ( ValidationTypes . isAny ( expression , xDir ) ) {
6163
+ if ( ValidationTypes . isAny ( expression , yDir ) ) {
6164
+ result = true ;
6165
+ ValidationTypes . isAny ( expression , numeric ) ;
6166
+ } else if ( ValidationTypes . isAny ( expression , numeric ) ) {
6167
+ if ( ValidationTypes . isAny ( expression , yDir ) ) {
6162
6168
result = true ;
6163
-
6164
6169
ValidationTypes . isAny ( expression , numeric ) ;
6165
-
6166
- } else if ( ValidationTypes . isAny ( expression , numeric ) ) {
6167
-
6168
- //could also be two-part, so check the next part
6169
- if ( ValidationTypes . isAny ( expression , yDir ) ) {
6170
- ValidationTypes . isAny ( expression , numeric ) ;
6171
- }
6172
-
6170
+ } else if ( ValidationTypes . isAny ( expression , "center" ) ) {
6173
6171
result = true ;
6174
6172
}
6175
6173
}
6176
- }
6177
- }
6178
-
6174
+ } else if ( ValidationTypes . isAny ( expression , yDir ) ) {
6175
+ if ( ValidationTypes . isAny ( expression , xDir ) ) {
6176
+ result = true ;
6177
+ ValidationTypes . isAny ( expression , numeric ) ;
6178
+ } else if ( ValidationTypes . isAny ( expression , numeric ) ) {
6179
+ if ( ValidationTypes . isAny ( expression , xDir ) ) {
6180
+ result = true ;
6181
+ ValidationTypes . isAny ( expression , numeric ) ;
6182
+ } else if ( ValidationTypes . isAny ( expression , "center" ) ) {
6183
+ result = true ;
6184
+ }
6185
+ }
6186
+ } else if ( ValidationTypes . isAny ( expression , "center" ) ) {
6187
+ if ( ValidationTypes . isAny ( expression , xDir + " | " + yDir ) ) {
6188
+ result = true ;
6189
+ ValidationTypes . isAny ( expression , numeric ) ;
6190
+ }
6191
+ }
6192
+ }
6179
6193
6180
6194
return result ;
6181
6195
} ,
@@ -6282,9 +6296,10 @@ var ValidationTypes = {
6282
6296
} ;
6283
6297
6284
6298
6299
+
6285
6300
parserlib . css = {
6286
- Colors :Colors ,
6287
- Combinator :Combinator ,
6301
+ Colors :Colors ,
6302
+ Combinator :Combinator ,
6288
6303
Parser :Parser ,
6289
6304
PropertyName :PropertyName ,
6290
6305
PropertyValue :PropertyValue ,
0 commit comments