MCPcopy
hub / github.com/MrNothing/AI-Blocks / stringParse

Function stringParse

Sources/src/libs/jquery-ui.js:1509–1547  ·  view source on GitHub ↗
( string )

Source from the content-addressed store, hash-verified

1507}
1508
1509function stringParse( string ) {
1510 var inst = color(),
1511 rgba = inst._rgba = [];
1512
1513 string = string.toLowerCase();
1514
1515 each( stringParsers, function( i, parser ) {
1516 var parsed,
1517 match = parser.re.exec( string ),
1518 values = match && parser.parse( match ),
1519 spaceName = parser.space || "rgba";
1520
1521 if ( values ) {
1522 parsed = inst[ spaceName ]( values );
1523
1524 // If this was an rgba parse the assignment might happen twice
1525 // oh well....
1526 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
1527 rgba = inst._rgba = parsed._rgba;
1528
1529 // Exit each( stringParsers ) here because we matched
1530 return false;
1531 }
1532 } );
1533
1534 // Found a stringParser that handled it
1535 if ( rgba.length ) {
1536
1537 // If this came from a parsed string, force "transparent" when alpha is 0
1538 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
1539 if ( rgba.join() === "0,0,0,0" ) {
1540 jQuery.extend( rgba, colors.transparent );
1541 }
1542 return inst;
1543 }
1544
1545 // Named colors
1546 return colors[ string ];
1547}
1548
1549color.fn = jQuery.extend( color.prototype, {
1550 parse: function( red, green, blue, alpha ) {

Callers 1

jquery-ui.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected