Introduce background shorthand property (#5053)

* Introduce background shorthand style property

* Add text property in parser for BackgroundPosition value

reason: prevent parsing of background position (pass it as sample string)

* Introduce background-shorthand test page

* Modify parser unit tests to respect the new BackgroundPosition 'text' property
This commit is contained in:
Alexander Djenkov
2017-11-15 14:07:40 +02:00
committed by Svetoslav
parent ac3c895c89
commit fc9a0b7ad8
11 changed files with 110 additions and 2 deletions

View File

@@ -47,6 +47,7 @@ export interface VerticalAlignWithOffset {
export interface BackgroundPosition {
readonly x: HorizontalAlign | HorizontalAlignWithOffset;
readonly y: VerticalAlign | VerticalAlignWithOffset;
text?: string;
}
const urlRegEx = /\s*url\((?:('|")([^\1]*)\1|([^\)]*))\)\s*/gy;
@@ -623,6 +624,7 @@ export function parseBackground(text: string, start: number = 0): Parsed<Backgro
}
const position = parseBackgroundPosition(text, end, keyword);
if (position) {
position.value.text = text.substring(position.start, position.end);
value.position = position.value;
end = position.end;