Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with expanding the font shorthand property #5

Open
kapetan opened this issue Mar 1, 2015 · 0 comments
Open

Issue with expanding the font shorthand property #5

kapetan opened this issue Mar 1, 2015 · 0 comments

Comments

@kapetan
Copy link

kapetan commented Mar 1, 2015

I've encountered an error when trying parse the font shorthand property. E.g.

var source = 'body { font: 14px sans-serif; }';

var parser = new CSSParser();
var ast = parser.parse(source, false, true);

console.log(ast.cssText());

This outputs and empty body rule in the console.

body {
}

Even though this is a valid font declaration. But when the line-height is present the output is correct. So using body { font: 14px/28px sans-serif; } as source the property is expanded correctly.

This seems to be a general problem with the getToken and ungetToken methods.

var token = this.getToken(false, false);
this.ungetToken();
token = this.getToken(true, true);

The last call might return whitespace even though the skip whitespace argument is set to true, because it reads this.mLookAhead.

This seems to be causing the error when trying to parse the font property.

Is also seems that the code on github is older than that on npm. Is it possible to sync these?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant