Browse Source

Misc refactoring of parseColor()

v1.x
Tj Holowaychuk 14 years ago
parent
commit
896a0eda89
  1. 4
      lib/canvas.js

4
lib/canvas.js

@ -124,7 +124,7 @@ var parseColor = exports.parseColor = function(str){
, 1
];
// #RRGGBB
} else if ('#' == str.charAt(0) && str.length > 4) {
} else if ('#' == str[0] && str.length > 4) {
var captures = /#([a-fA-F\d]{2})([a-fA-F\d]{2})([a-fA-F\d]{2})/.exec(str);
if (!captures) return;
return cache[str] = [
@ -134,7 +134,7 @@ var parseColor = exports.parseColor = function(str){
, 1
];
// #RGB
} else if ('#' == str.charAt(0)) {
} else if ('#' == str[0]) {
var captures = /#([a-fA-F\d])([a-fA-F\d])([a-fA-F\d])/.exec(str);
if (!captures) return;
return cache[str] = [

Loading…
Cancel
Save