@@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121THE SOFTWARE.
2222
2323*/
24- /* Build time: 25-October-2011 09:25:06 */
25-
24+ /* Build time: 15-November-2011 07:33:18 */
2625/*!
2726Parser-Lib
2827Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -46,11 +45,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4645THE SOFTWARE.
4746
4847*/
49- /* Build time: 25-October -2011 09 :11:57 */
48+ /* Build time: 1-November -2011 12 :11:55 */
5049var parserlib = { } ;
5150( function ( ) {
5251
53-
5452/**
5553 * A generic base to inherit from for any object
5654 * that needs event handling.
@@ -920,8 +918,6 @@ TokenStreamBase.prototype = {
920918} ;
921919
922920
923-
924-
925921parserlib . util = {
926922StringReader : StringReader ,
927923SyntaxError : SyntaxError ,
@@ -930,8 +926,6 @@ EventTarget : EventTarget,
930926TokenStreamBase : TokenStreamBase
931927} ;
932928} ) ( ) ;
933-
934-
935929/*
936930Parser-Lib
937931Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -955,15 +949,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
955949THE SOFTWARE.
956950
957951*/
958- /* Build time: 25-October -2011 09 :11:57 */
952+ /* Build time: 1-November -2011 12 :11:55 */
959953( function ( ) {
960954var EventTarget = parserlib . util . EventTarget ,
961955TokenStreamBase = parserlib . util . TokenStreamBase ,
962956StringReader = parserlib . util . StringReader ,
963957SyntaxError = parserlib . util . SyntaxError ,
964958SyntaxUnit = parserlib . util . SyntaxUnit ;
965959
966-
967960var Colors = {
968961 aliceblue :"#f0f8ff" ,
969962 antiquewhite :"#faebd7" ,
@@ -1143,7 +1136,6 @@ function Combinator(text, line, col){
11431136Combinator . prototype = new SyntaxUnit ( ) ;
11441137Combinator . prototype . constructor = Combinator ;
11451138
1146-
11471139/**
11481140 * Represents a media feature, such as max-width:500.
11491141 * @namespace parserlib.css
@@ -1175,7 +1167,6 @@ function MediaFeature(name, value){
11751167MediaFeature . prototype = new SyntaxUnit ( ) ;
11761168MediaFeature . prototype . constructor = MediaFeature ;
11771169
1178-
11791170/**
11801171 * Represents an individual media query.
11811172 * @namespace parserlib.css
@@ -1218,7 +1209,6 @@ function MediaQuery(modifier, mediaType, features, line, col){
12181209MediaQuery . prototype = new SyntaxUnit ( ) ;
12191210MediaQuery . prototype . constructor = MediaQuery ;
12201211
1221-
12221212/**
12231213 * A CSS3 parser.
12241214 * @namespace parserlib.css
@@ -3396,12 +3386,22 @@ nth
33963386 ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*
33973387 ;
33983388*/
3389+ //This file will likely change a lot! Very experimental!
3390+
33993391var ValidationType = {
34003392
34013393 "absolute-size" : function ( part ) {
34023394 return this . identifier ( part , "xx-small | x-small | small | medium | large | x-large | xx-large" ) ;
34033395 } ,
34043396
3397+ "attachment" : function ( part ) {
3398+ return this . identifier ( part , "scroll | fixed | local" ) ;
3399+ } ,
3400+
3401+ "box" : function ( part ) {
3402+ return this . identifier ( part , "padding-box | border-box | content-box" ) ;
3403+ } ,
3404+
34053405 "relative-size" : function ( part ) {
34063406 return this . identifier ( part , "smaller | larger" ) ;
34073407 } ,
@@ -3449,6 +3449,10 @@ var ValidationType = {
34493449 return this . uri ( part ) ;
34503450 } ,
34513451
3452+ "bg-image" : function ( part ) {
3453+ return this . image ( part ) || part == "none" ;
3454+ } ,
3455+
34523456 "percentage" : function ( part ) {
34533457 return part . type == "percentage" || part == "0" ;
34543458 } ,
@@ -3483,25 +3487,25 @@ var Properties = {
34833487 "alignment-baseline" : 1 ,
34843488 "animation" : 1 ,
34853489 "animation-delay" : 1 ,
3486- "animation-direction" : 1 ,
3490+ "animation-direction" : { multi : [ "normal | alternate" ] , separator : "," } ,
34873491 "animation-duration" : 1 ,
34883492 "animation-fill-mode" : 1 ,
3489- "animation-iteration-count" : 1 ,
3493+ "animation-iteration-count" : { multi : [ "number" , "infinite" ] , separator : "," } ,
34903494 "animation-name" : 1 ,
3491- "animation-play-state" : 1 ,
3495+ "animation-play-state" : { multi : [ "running | paused" ] , separator : "," } ,
34923496 "animation-timing-function" : 1 ,
34933497 "appearance" : 1 ,
34943498 "azimuth" : 1 ,
34953499
34963500 //B
34973501 "backface-visibility" : 1 ,
34983502 "background" : 1 ,
3499- "background-attachment" : [ "scroll | fixed | inherit" ] ,
3503+ "background-attachment" : { multi : [ "attachment" ] , separator : "," } ,
35003504 "background-break" : 1 ,
3501- "background-clip" : 1 ,
3505+ "background-clip" : { multi : [ "box" ] , separator : "," } ,
35023506 "background-color" : [ "color" , "inherit" ] ,
3503- "background-image" : 1 ,
3504- "background-origin" : 1 ,
3507+ "background-image" : { multi : [ "bg-image" ] , separator : "," } ,
3508+ "background-origin" : { multi : [ "box" ] , separator : "," } ,
35053509 "background-position" : 1 ,
35063510 "background-repeat" : [ "repeat | repeat-x | repeat-y | no-repeat | inherit" ] ,
35073511 "background-size" : 1 ,
@@ -3659,7 +3663,7 @@ var Properties = {
36593663 "line-stacking-strategy" : 1 ,
36603664 "list-style" : 1 ,
36613665 "list-style-image" : [ "uri" , "none | inherit" ] ,
3662- "list-style-position" : [ "inside | outsider | inherit" ] ,
3666+ "list-style-position" : [ "inside | outside | inherit" ] ,
36633667 "list-style-type" : [ "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit" ] ,
36643668
36653669 //M
@@ -3769,6 +3773,7 @@ var Properties = {
37693773 "text-indent" : [ "length" , "percentage" , "inherit" ] ,
37703774 "text-justify" : [ "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida" ] ,
37713775 "text-outline" : 1 ,
3776+ "text-overflow" : 1 ,
37723777 "text-shadow" : 1 ,
37733778 "text-transform" : [ "capitalize | uppercase | lowercase | none | inherit" ] ,
37743779 "text-wrap" : [ "normal | none | avoid" ] ,
@@ -3852,8 +3857,10 @@ var Properties = {
38523857 i , len , j , count ,
38533858 msg ,
38543859 values ,
3860+ last ,
38553861 parts = value . parts ;
38563862
3863+ //if there's a maximum set, use it (max can't be 0)
38573864 if ( spec . max ) {
38583865 if ( parts . length > spec . max ) {
38593866 throw new ValidationError ( "Expected a max of " + spec . max + " property values but found " + parts . length + "." , value . line , value . col ) ;
@@ -3867,25 +3874,45 @@ var Properties = {
38673874 for ( i = 0 , len = parts . length ; i < len ; i ++ ) {
38683875 msg = [ ] ;
38693876 valid = false ;
3870- for ( j = 0 , count = values . length ; j < count ; j ++ ) {
3871- if ( typeof ValidationType [ values [ j ] ] == "undefined" ) {
3872- if ( ValidationType . identifier ( parts [ i ] , values [ j ] ) ) {
3873- valid = true ;
3874- break ;
3875- }
3876- msg . push ( "one of (" + values [ j ] + ")" ) ;
3877+
3878+ if ( spec . separator && parts [ i ] . type == "operator" ) {
3879+
3880+ //two operators in a row - not allowed?
3881+ if ( ( last && last . type == "operator" ) ) {
3882+ msg = msg . concat ( values ) ;
3883+ } else if ( i == len - 1 ) {
3884+ msg = msg . concat ( "end of line" ) ;
3885+ } else if ( parts [ i ] != spec . separator ) {
3886+ msg . push ( "'" + spec . separator + "'" ) ;
38773887 } else {
3878- if ( ValidationType [ values [ j ] ] ( parts [ i ] ) ) {
3879- valid = true ;
3880- break ;
3881- }
3882- msg . push ( values [ j ] ) ;
3883- }
3888+ valid = true ;
3889+ }
3890+ } else {
3891+
3892+ for ( j = 0 , count = values . length ; j < count ; j ++ ) {
3893+ if ( typeof ValidationType [ values [ j ] ] == "undefined" ) {
3894+ if ( ValidationType . identifier ( parts [ i ] , values [ j ] ) ) {
3895+ valid = true ;
3896+ break ;
3897+ }
3898+ msg . push ( "one of (" + values [ j ] + ")" ) ;
3899+ } else {
3900+ if ( ValidationType [ values [ j ] ] ( parts [ i ] ) ) {
3901+ valid = true ;
3902+ break ;
3903+ }
3904+ msg . push ( values [ j ] ) ;
3905+ }
3906+ }
38843907 }
3908+
38853909
38863910 if ( ! valid ) {
38873911 throw new ValidationError ( "Expected " + msg . join ( " or " ) + " but found '" + parts [ i ] + "'." , value . line , value . col ) ;
38883912 }
3913+
3914+
3915+ last = parts [ i ] ;
38893916 }
38903917
38913918 } ;
@@ -3923,7 +3950,6 @@ PropertyName.prototype.constructor = PropertyName;
39233950PropertyName . prototype . toString = function ( ) {
39243951 return ( this . hack ? this . hack : "" ) + this . text ;
39253952} ;
3926-
39273953/**
39283954 * Represents a single part of a CSS property value, meaning that it represents
39293955 * just everything single part between ":" and ";". If there are multiple values
@@ -3952,7 +3978,6 @@ function PropertyValue(parts, line, col){
39523978PropertyValue . prototype = new SyntaxUnit ( ) ;
39533979PropertyValue . prototype . constructor = PropertyValue ;
39543980
3955-
39563981/**
39573982 * Represents a single part of a CSS property value, meaning that it represents
39583983 * just one part of the data between ":" and ";".
@@ -4060,6 +4085,29 @@ function PropertyValuePart(text, line, col){
40604085 this . red = + RegExp . $1 * 255 / 100 ;
40614086 this . green = + RegExp . $2 * 255 / 100 ;
40624087 this . blue = + RegExp . $3 * 255 / 100 ;
4088+ } else if ( / ^ r g b a \( \s * ( \d + ) \s * , \s * ( \d + ) \s * , \s * ( \d + ) \s * , \s * ( [ \d \. ] + ) \s * \) / i. test ( text ) ) { //rgba() color with absolute numbers
4089+ this . type = "color" ;
4090+ this . red = + RegExp . $1 ;
4091+ this . green = + RegExp . $2 ;
4092+ this . blue = + RegExp . $3 ;
4093+ this . alpha = + RegExp . $4 ;
4094+ } else if ( / ^ r g b a \( \s * ( \d + ) % \s * , \s * ( \d + ) % \s * , \s * ( \d + ) % \s * , \s * ( [ \d \. ] + ) \s * \) / i. test ( text ) ) { //rgba() color with percentages
4095+ this . type = "color" ;
4096+ this . red = + RegExp . $1 * 255 / 100 ;
4097+ this . green = + RegExp . $2 * 255 / 100 ;
4098+ this . blue = + RegExp . $3 * 255 / 100 ;
4099+ this . alpha = + RegExp . $4 ;
4100+ } else if ( / ^ h s l \( \s * ( \d + ) \s * , \s * ( \d + ) % \s * , \s * ( \d + ) % \s * \) / i. test ( text ) ) { //hsl()
4101+ this . type = "color" ;
4102+ this . hue = + RegExp . $1 ;
4103+ this . saturation = + RegExp . $2 / 100 ;
4104+ this . lightness = + RegExp . $3 / 100 ;
4105+ } else if ( / ^ h s l a \( \s * ( \d + ) \s * , \s * ( \d + ) % \s * , \s * ( \d + ) % \s * , \s * ( [ \d \. ] + ) \s * \) / i. test ( text ) ) { //hsla() color with percentages
4106+ this . type = "color" ;
4107+ this . hue = + RegExp . $1 ;
4108+ this . saturation = + RegExp . $2 / 100 ;
4109+ this . lightness = + RegExp . $3 / 100 ;
4110+ this . alpha = + RegExp . $4 ;
40634111 } else if ( / ^ u r l \( [ " ' ] ? ( [ ^ \) " ' ] + ) [ " ' ] ? \) / i. test ( text ) ) { //URI
40644112 this . type = "uri" ;
40654113 this . uri = RegExp . $1 ;
@@ -4144,7 +4192,6 @@ function Selector(parts, line, col){
41444192Selector . prototype = new SyntaxUnit ( ) ;
41454193Selector . prototype . constructor = Selector ;
41464194
4147-
41484195/**
41494196 * Represents a single part of a selector string, meaning a single set of
41504197 * element name and modifiers. This does not include combinators such as
@@ -4186,7 +4233,6 @@ function SelectorPart(elementName, modifiers, text, line, col){
41864233SelectorPart . prototype = new SyntaxUnit ( ) ;
41874234SelectorPart . prototype . constructor = SelectorPart ;
41884235
4189-
41904236/**
41914237 * Represents a selector modifier string, meaning a class name, element name,
41924238 * element ID, pseudo rule, etc.
@@ -4222,7 +4268,6 @@ function SelectorSubPart(text, type, line, col){
42224268SelectorSubPart . prototype = new SyntaxUnit ( ) ;
42234269SelectorSubPart . prototype . constructor = SelectorSubPart ;
42244270
4225-
42264271/**
42274272 * Represents a selector's specificity.
42284273 * @namespace parserlib.css
@@ -4345,7 +4390,6 @@ Specificity.calculate = function(selector){
43454390} ;
43464391
43474392
4348-
43494393var h = / ^ [ 0 - 9 a - f A - F ] $ / ,
43504394 nonascii = / ^ [ \u0080 - \uFFFF ] $ / ,
43514395 nl = / \n | \r \n | \r | \f / ;
@@ -5343,7 +5387,6 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
53435387 }
53445388} ) ;
53455389
5346-
53475390var Tokens = [
53485391
53495392 /*
@@ -5550,7 +5593,6 @@ var Tokens = [
55505593
55515594
55525595
5553-
55545596/**
55555597 * Type to use when a validation error occurs.
55565598 * @class ValidationError
@@ -5588,7 +5630,6 @@ function ValidationError(message, line, col){
55885630//inherit from Error
55895631ValidationError . prototype = new Error ( ) ;
55905632
5591-
55925633parserlib . css = {
55935634Colors :Colors ,
55945635Combinator :Combinator ,
@@ -5607,9 +5648,6 @@ Tokens :Tokens,
56075648ValidationError :ValidationError
56085649} ;
56095650} ) ( ) ;
5610-
5611-
5612-
56135651/**
56145652 * Main CSSLint object.
56155653 * @class CSSLint
@@ -5623,7 +5661,7 @@ var CSSLint = (function(){
56235661 formatters = [ ] ,
56245662 api = new parserlib . util . EventTarget ( ) ;
56255663
5626- api . version = "0.8.1 " ;
5664+ api . version = "0.8.5 " ;
56275665
56285666 //-------------------------------------------------------------------------
56295667 // Rule Management
@@ -5791,7 +5829,6 @@ var CSSLint = (function(){
57915829 return api ;
57925830
57935831} ) ( ) ;
5794-
57955832/*global CSSLint*/
57965833/**
57975834 * An instance of Report is used to report results of the
@@ -8148,6 +8185,4 @@ CSSLint.addFormatter({
81488185 }
81498186} ) ;
81508187
8151-
81528188exports . CSSLint = CSSLint ;
8153-
0 commit comments