code: function splitStyleProperty(property) {
              var token = /((?:[^"']|".*?"|'.*?')*?)([(,)]|$)/g;
              var recurse = function () {
                  var array = [];
                  for (;;) {
                      var result = token.exec(property);
                      if (result[2] === "(") {
                          var str = result[1].trim() + "(" + recurse().join(",") + ")";
                          result = token.exec(property);
                          str += result[1];
                          array.push(str);
                      } else {
                          array.push(result[1].trim());
                      }
                      if (result[2] !== ",") {
                          return array;
                      }
                  }
              };
              return (recurse());
          }
docs: simple css property splitter (used to find color stop arguments in gradients)