Fix: background-position with negative values

This commit is contained in:
vakrilov
2015-11-16 16:29:27 +02:00
parent 2b474059ea
commit 831a44f218
5 changed files with 91 additions and 40 deletions

View File

@@ -31,7 +31,7 @@ Parser.prototype.ident = function(){
};
Parser.prototype.int = function(){
var m = /^((\d+)(\S+)?) */.exec(this.str);
var m = /^(([-\+]?\d+)(\S+)?) */.exec(this.str);
if (!m) return;
this.skip(m);
var n = ~~m[2];
@@ -46,7 +46,7 @@ Parser.prototype.int = function(){
};
Parser.prototype.float = function(){
var m = /^(((?:\d+)?\.\d+)(\S+)?) */.exec(this.str);
var m = /^(((?:[-\+]?\d+)?\.\d+)(\S+)?) */.exec(this.str);
if (!m) return;
this.skip(m);
var n = parseFloat(m[2]);

View File

@@ -2,12 +2,10 @@ declare module "css-value" {
interface CSSValue {
type: string;
string: string;
unit: string;
value: number;
unit?: string;
value?: number;
}
interface ParserFunction {
(cssValue: string): Array<CSSValue>;
}
export = ParserFunction;
function parse(cssValue: string): Array<CSSValue>;
export = parse;
}