@@ -388,10 +388,39 @@ ValidationTypes = {
388388 return part . type === "color" || String ( part ) === "transparent" || String ( part ) === "currentColor" ;
389389 } ,
390390
391+ // The SVG <color> spec doesn't include "currentColor" or "transparent" as a color.
392+ "<color-svg>" : function ( part ) {
393+ return part . type === "color" ;
394+ } ,
395+
396+ "<icccolor>" : function ( part ) {
397+ /* ex.:
398+ https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/local
399+ icc-color(acmecmyk, 0.11, 0.48, 0.83, 0.00)
400+ cielab(62.253188, 23.950124, 48.410653)
401+ cielch(62.253188, 54.011108, 63.677091)
402+ icc-color(FooColors, Sandy23C)
403+ http://www.w3.org/TR/2009/WD-SVGColor12-20091001/#iccnamedcolor
404+ ~"icc-color(" name (comma-wsp number)+ ")"
405+ ~"icc-named-color(" name comma-wsp namedColor ")"
406+ ~"cielab(" lightness comma-wsp a-value comma-wsp b-value ")"
407+ ~"cielchab(" lightness comma-wsp chroma comma-wsp hue ")"
408+ */
409+ return ValidationTypes . isLiteral ( part , "cielab() | cielch() | cielchab() | icc-color() | icc-named-color()" ) ;
410+ } ,
411+
391412 "<number>" : function ( part ) {
392413 return part . type === "number" || this [ "<integer>" ] ( part ) ;
393414 } ,
394415
416+ "<miterlimit>" : function ( part ) {
417+ return this [ "<number>" ] ( part ) && part . value >= 1 ;
418+ } ,
419+
420+ "<opacity-value>" : function ( part ) {
421+ return this [ "<number>" ] ( part ) && part . value >= 0 && part . value <= 1 ;
422+ } ,
423+
395424 "<integer>" : function ( part ) {
396425 return part . type === "integer" ;
397426 } ,
@@ -517,10 +546,31 @@ ValidationTypes = {
517546 // <basic-shape> || <geometry-box>
518547 Matcher . cast ( "<basic-shape>" ) . oror ( "<geometry-box>" ) ,
519548
549+ "<dasharray>" :
550+ // "list of comma and/or white space separated <length>s and
551+ // <percentage>s". We use <padding-width> to enforce the
552+ // nonnegative constraint.
553+ Matcher . cast ( "<padding-width>" )
554+ . braces ( 1 , Infinity , "#" , Matcher . cast ( "," ) . question ( ) ) ,
555+
520556 "<filter-function-list>" :
521557 // [ <filter-function> | <uri> ]+
522558 Matcher . cast ( "<filter-function> | <uri>" ) . plus ( ) ,
523559
560+ "<paint>" :
561+ // none | currentColor | <color> [<icccolor>]? |
562+ // <funciri> [ none | currentColor | <color> [<icccolor>]? ]?
563+
564+ // Note that <color> here is "as defined in the SVG spec", which
565+ // is more restrictive that the <color> defined in the CSS spec.
566+ Matcher . alt ( "<paint-basic>" ,
567+ Matcher . seq ( "<uri>" , Matcher . cast ( "<paint-basic>" ) . question ( ) ) ) ,
568+ // Helper definition for <paint> above.
569+ "<paint-basic>" :
570+ Matcher . alt ( "none" , "currentColor" ,
571+ Matcher . seq ( "<color-svg>" ,
572+ Matcher . cast ( "<icccolor>" ) . question ( ) ) ) ,
573+
524574 "<position>" :
525575 // <position> = [
526576 // [ left | center | right | top | bottom | <percentage> | <length> ]
0 commit comments