Skip to content

Commit 1086fe5

Browse files
author
Onno van der Zee
committed
baseline properties and connected text-decoration
1 parent ceb2297 commit 1086fe5

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

src/css/Properties.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var Properties = {
99
"-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch",
1010
"-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch",
1111
"alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>",
12-
"alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
12+
"alignment-baseline" : "auto | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical | inherit",
1313
"animation" : 1,
1414
"animation-delay" : { multi: "<time>", comma: true },
1515
"animation-direction" : { multi: "normal | alternate", comma: true },
@@ -271,7 +271,7 @@ var Properties = {
271271
//D
272272
"direction" : "ltr | rtl | inherit",
273273
"display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex",
274-
"dominant-baseline" : 1,
274+
"dominant-baseline" : "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge | inherit",
275275
"drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
276276
"drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
277277
"drop-initial-before-adjust" : "before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>",
@@ -497,7 +497,7 @@ var Properties = {
497497
"text-anchor" : "start | middle | end | inherit",
498498
"text-align" : "left | right | center | justify | match-parent | start | end | inherit" ,
499499
"text-align-last" : 1,
500-
"text-decoration" : 1,
500+
"text-decoration" : "none | <text-decoration> | inherit",
501501
"text-emphasis" : 1,
502502
"text-height" : 1,
503503
"text-indent" : "<length> | <percentage> | inherit",

src/css/ValidationTypes.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,33 @@ var ValidationTypes = {
431431
throw new ValidationError("Expected (none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]) but found '" + expression.value.text + "'.", part.line, part.col);
432432
}
433433

434+
return result;
435+
},
436+
437+
"<text-decoration>": function(expression) {
438+
// none | [ underline || overline || line-through || blink ] | inherit
439+
var part,
440+
result,
441+
someOf = "[ underline || overline || line-through || blink ]",
442+
identifiers = {},
443+
found;
444+
445+
do {
446+
part = expression.next();
447+
found = 0;
448+
if (someOf.indexOf(part) > -1) {
449+
if (!identifiers[part]) {
450+
identifiers[part] = 0;
451+
}
452+
identifiers[part]++;
453+
found = identifiers[part];
454+
}
455+
} while (found == 1 && expression.hasNext());
456+
457+
result = found == 1 && !expression.hasNext();
458+
if (found === 0 && JSON.stringify(identifiers) == '{}') {
459+
expression.previous();
460+
}
434461
return result;
435462
}
436463
}

tests/css/Validation.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,25 @@
879879
}
880880
}));
881881

882+
suite.add(new ValidationTestCase({
883+
property: "text-decoration",
884+
885+
valid: [
886+
"none",
887+
"underline",
888+
"underline overline line-through blink",
889+
"inherit"
890+
],
891+
892+
invalid: {
893+
"none underline" : "Expected end of value but found 'underline'.",
894+
"line-through none" : "Expected (none | <text-decoration> | inherit) but found 'line-through none'.",
895+
"inherit blink" : "Expected end of value but found 'blink'.",
896+
"overline inherit" : "Expected (none | <text-decoration> | inherit) but found 'overline inherit'.",
897+
"foo" : "Expected (none | <text-decoration> | inherit) but found 'foo'."
898+
}
899+
}));
900+
882901
suite.add(new ValidationTestCase({
883902
property: "text-rendering",
884903

0 commit comments

Comments
 (0)