@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121THE SOFTWARE.
2222
2323*/
24- /* Build time: 21 -October-2011 04:48:14 */
24+ /* Build time: 25 -October-2011 09:11:57 */
2525var parserlib = { } ;
2626( function ( ) {
2727
@@ -930,7 +930,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
930930THE SOFTWARE.
931931
932932*/
933- /* Build time: 21 -October-2011 04:48:14 */
933+ /* Build time: 25 -October-2011 09:11:57 */
934934( function ( ) {
935935var EventTarget = parserlib . util . EventTarget ,
936936TokenStreamBase = parserlib . util . TokenStreamBase ,
@@ -3404,6 +3404,10 @@ var ValidationType = {
34043404 return part . type == "color" || part == "transparent" ;
34053405 } ,
34063406
3407+ "number" : function ( part ) {
3408+ return part . type == "number" || this . integer ( part ) ;
3409+ } ,
3410+
34073411 "integer" : function ( part ) {
34083412 return part . type == "integer" ;
34093413 } ,
@@ -3491,13 +3495,13 @@ var Properties = {
34913495 "border-bottom-style" : [ "border-style" ] ,
34923496 "border-bottom-width" : [ "border-width" ] ,
34933497 "border-collapse" : [ "collapse | separate | inherit" ] ,
3494- "border-color" : [ "color" , "inherit" ] ,
3498+ "border-color" : { multi : [ "color" , "inherit" ] , max : 4 } ,
34953499 "border-image" : 1 ,
3496- "border-image-outset" : 1 ,
3497- "border-image-repeat" : 1 ,
3500+ "border-image-outset" : { multi : [ "length" , "number" ] , max : 4 } ,
3501+ "border-image-repeat" : { multi : [ "stretch | repeat | round" ] , max : 2 } ,
34983502 "border-image-slice" : 1 ,
34993503 "border-image-source" : [ "image" , "none" ] ,
3500- "border-image-width" : 1 ,
3504+ "border-image-width" : { multi : [ "length" , "percentage" , "number" , "auto" ] , max : 4 } ,
35013505 "border-left" : 1 ,
35023506 "border-left-color" : [ "color" , "inherit" ] ,
35033507 "border-left-style" : [ "border-style" ] ,
@@ -3508,14 +3512,14 @@ var Properties = {
35083512 "border-right-style" : [ "border-style" ] ,
35093513 "border-right-width" : [ "border-width" ] ,
35103514 "border-spacing" : 1 ,
3511- "border-style" : 1 ,
3515+ "border-style" : { multi : [ "border-style" ] , max : 4 } ,
35123516 "border-top" : 1 ,
35133517 "border-top-color" : [ "color" , "inherit" ] ,
35143518 "border-top-left-radius" : 1 ,
35153519 "border-top-right-radius" : 1 ,
35163520 "border-top-style" : [ "border-style" ] ,
35173521 "border-top-width" : [ "border-width" ] ,
3518- "border-width" : 1 ,
3522+ "border-width" : { multi : [ "border-width" ] , max : 4 } ,
35193523 "bottom" : [ "margin-width" , "inherit" ] ,
35203524 "box-align" : [ "start | end | center | baseline | stretch" ] , //http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/
35213525 "box-decoration-break" : [ "slice |clone" ] ,
@@ -3634,7 +3638,7 @@ var Properties = {
36343638 "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" ] ,
36353639
36363640 //M
3637- "margin" : 1 ,
3641+ "margin" : { multi : [ "margin-width" , "inherit" ] , max : 4 } ,
36383642 "margin-bottom" : [ "margin-width" , "inherit" ] ,
36393643 "margin-left" : [ "margin-width" , "inherit" ] ,
36403644 "margin-right" : [ "margin-width" , "inherit" ] ,
@@ -3674,7 +3678,7 @@ var Properties = {
36743678 "overflow-y" : 1 ,
36753679
36763680 //P
3677- "padding" : 1 ,
3681+ "padding" : { multi : [ "padding-width" , "inherit" ] , max : 4 } ,
36783682 "padding-bottom" : [ "padding-width" , "inherit" ] ,
36793683 "padding-left" : [ "padding-width" , "inherit" ] ,
36803684 "padding-right" : [ "padding-width" , "inherit" ] ,
@@ -3816,6 +3820,51 @@ var Properties = {
38163820 }
38173821 } ;
38183822 } ) ( Properties [ prop ] ) ;
3823+ } else if ( typeof Properties [ prop ] == "object" ) {
3824+ Properties [ prop ] = ( function ( spec ) {
3825+ return function ( value ) {
3826+ var valid ,
3827+ i , len , j , count ,
3828+ msg ,
3829+ values ,
3830+ parts = value . parts ;
3831+
3832+ if ( spec . max ) {
3833+ if ( parts . length > spec . max ) {
3834+ throw new ValidationError ( "Expected a max of " + spec . max + " property values but found " + parts . length + "." , value . line , value . col ) ;
3835+ }
3836+ }
3837+
3838+ if ( spec . multi ) {
3839+ values = spec . multi ;
3840+ }
3841+
3842+ for ( i = 0 , len = parts . length ; i < len ; i ++ ) {
3843+ msg = [ ] ;
3844+ valid = false ;
3845+ for ( j = 0 , count = values . length ; j < count ; j ++ ) {
3846+ if ( typeof ValidationType [ values [ j ] ] == "undefined" ) {
3847+ if ( ValidationType . identifier ( parts [ i ] , values [ j ] ) ) {
3848+ valid = true ;
3849+ break ;
3850+ }
3851+ msg . push ( "one of (" + values [ j ] + ")" ) ;
3852+ } else {
3853+ if ( ValidationType [ values [ j ] ] ( parts [ i ] ) ) {
3854+ valid = true ;
3855+ break ;
3856+ }
3857+ msg . push ( values [ j ] ) ;
3858+ }
3859+ }
3860+
3861+ if ( ! valid ) {
3862+ throw new ValidationError ( "Expected " + msg . join ( " or " ) + " but found '" + parts [ i ] + "'." , value . line , value . col ) ;
3863+ }
3864+ }
3865+
3866+ } ;
3867+ } ) ( Properties [ prop ] ) ;
38193868 }
38203869 }
38213870 }
0 commit comments