Skip to content

Commit 448ce9a

Browse files
committed
Merge pull request #83 from nschonni/80-add-overflow-wrap
Add overflow-wrap property
2 parents e2c66a0 + fa7ae05 commit 448ce9a

File tree

2 files changed

+74
-47
lines changed

2 files changed

+74
-47
lines changed

src/css/Properties.js

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,68 +12,68 @@ var Properties = {
1212
"animation-name" : { multi: "none | <ident>", comma: true },
1313
"animation-play-state" : { multi: "running | paused", comma: true },
1414
"animation-timing-function" : 1,
15-
15+
1616
//vendor prefixed
1717
"-moz-animation-delay" : { multi: "<time>", comma: true },
1818
"-moz-animation-direction" : { multi: "normal | alternate", comma: true },
1919
"-moz-animation-duration" : { multi: "<time>", comma: true },
2020
"-moz-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
2121
"-moz-animation-name" : { multi: "none | <ident>", comma: true },
2222
"-moz-animation-play-state" : { multi: "running | paused", comma: true },
23-
23+
2424
"-ms-animation-delay" : { multi: "<time>", comma: true },
2525
"-ms-animation-direction" : { multi: "normal | alternate", comma: true },
2626
"-ms-animation-duration" : { multi: "<time>", comma: true },
2727
"-ms-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
2828
"-ms-animation-name" : { multi: "none | <ident>", comma: true },
2929
"-ms-animation-play-state" : { multi: "running | paused", comma: true },
30-
30+
3131
"-webkit-animation-delay" : { multi: "<time>", comma: true },
3232
"-webkit-animation-direction" : { multi: "normal | alternate", comma: true },
3333
"-webkit-animation-duration" : { multi: "<time>", comma: true },
3434
"-webkit-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
3535
"-webkit-animation-name" : { multi: "none | <ident>", comma: true },
3636
"-webkit-animation-play-state" : { multi: "running | paused", comma: true },
37-
37+
3838
"-o-animation-delay" : { multi: "<time>", comma: true },
3939
"-o-animation-direction" : { multi: "normal | alternate", comma: true },
4040
"-o-animation-duration" : { multi: "<time>", comma: true },
4141
"-o-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
4242
"-o-animation-name" : { multi: "none | <ident>", comma: true },
43-
"-o-animation-play-state" : { multi: "running | paused", comma: true },
44-
43+
"-o-animation-play-state" : { multi: "running | paused", comma: true },
44+
4545
"appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit",
4646
"azimuth" : function (expression) {
4747
var simple = "<angle> | leftwards | rightwards | inherit",
4848
direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side",
4949
behind = false,
5050
valid = false,
5151
part;
52-
52+
5353
if (!ValidationTypes.isAny(expression, simple)) {
5454
if (ValidationTypes.isAny(expression, "behind")) {
5555
behind = true;
5656
valid = true;
5757
}
58-
58+
5959
if (ValidationTypes.isAny(expression, direction)) {
6060
valid = true;
6161
if (!behind) {
6262
ValidationTypes.isAny(expression, "behind");
6363
}
6464
}
6565
}
66-
66+
6767
if (expression.hasNext()) {
6868
part = expression.next();
6969
if (valid) {
7070
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
7171
} else {
7272
throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col);
7373
}
74-
}
74+
}
7575
},
76-
76+
7777
//B
7878
"backface-visibility" : "visible | hidden",
7979
"background" : 1,
@@ -106,42 +106,42 @@ var Properties = {
106106
"border-image-outset" : { multi: "<length> | <number>", max: 4 },
107107
"border-image-repeat" : { multi: "stretch | repeat | round", max: 2 },
108108
"border-image-slice" : function(expression) {
109-
109+
110110
var valid = false,
111111
numeric = "<number> | <percentage>",
112112
fill = false,
113113
count = 0,
114114
max = 4,
115115
part;
116-
116+
117117
if (ValidationTypes.isAny(expression, "fill")) {
118118
fill = true;
119119
valid = true;
120120
}
121-
121+
122122
while (expression.hasNext() && count < max) {
123123
valid = ValidationTypes.isAny(expression, numeric);
124124
if (!valid) {
125125
break;
126126
}
127127
count++;
128128
}
129-
130-
129+
130+
131131
if (!fill) {
132132
ValidationTypes.isAny(expression, "fill");
133133
} else {
134134
valid = true;
135135
}
136-
136+
137137
if (expression.hasNext()) {
138138
part = expression.next();
139139
if (valid) {
140140
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
141141
} else {
142142
throw new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '" + part + "'.", part.line, part.col);
143143
}
144-
}
144+
}
145145
},
146146
"border-image-source" : "<image> | none",
147147
"border-image-width" : { multi: "<length> | <percentage> | <number> | auto", max: 4 },
@@ -150,7 +150,7 @@ var Properties = {
150150
"border-left-style" : "<border-style>",
151151
"border-left-width" : "<border-width>",
152152
"border-radius" : function(expression) {
153-
153+
154154
var valid = false,
155155
simple = "<length> | <percentage> | inherit",
156156
slash = false,
@@ -162,7 +162,7 @@ var Properties = {
162162
while (expression.hasNext() && count < max) {
163163
valid = ValidationTypes.isAny(expression, simple);
164164
if (!valid) {
165-
165+
166166
if (expression.peek() == "/" && count > 0 && !slash) {
167167
slash = true;
168168
max = count + 5;
@@ -173,15 +173,15 @@ var Properties = {
173173
}
174174
count++;
175175
}
176-
176+
177177
if (expression.hasNext()) {
178178
part = expression.next();
179179
if (valid) {
180180
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
181181
} else {
182182
throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col);
183183
}
184-
}
184+
}
185185
},
186186
"border-right" : "<border-width> || <border-style> || <color>",
187187
"border-right-color" : "<color> | inherit",
@@ -196,7 +196,7 @@ var Properties = {
196196
"border-top-style" : "<border-style>",
197197
"border-top-width" : "<border-width>",
198198
"border-width" : { multi: "<border-width>", max: 4 },
199-
"bottom" : "<margin-width> | inherit",
199+
"bottom" : "<margin-width> | inherit",
200200
"box-align" : "start | end | center | baseline | stretch", //http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/
201201
"box-decoration-break" : "slice |clone",
202202
"box-direction" : "normal | reverse | inherit",
@@ -211,19 +211,19 @@ var Properties = {
211211
part;
212212

213213
if (!ValidationTypes.isAny(expression, "none")) {
214-
Validation.multiProperty("<shadow>", expression, true, Infinity);
214+
Validation.multiProperty("<shadow>", expression, true, Infinity);
215215
} else {
216216
if (expression.hasNext()) {
217217
part = expression.next();
218218
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
219-
}
219+
}
220220
}
221221
},
222222
"box-sizing" : "content-box | border-box | inherit",
223223
"break-after" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
224224
"break-before" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
225225
"break-inside" : "auto | avoid | avoid-page | avoid-column",
226-
226+
227227
//C
228228
"caption-side" : "top | bottom | inherit",
229229
"clear" : "none | right | left | both | inherit",
@@ -248,7 +248,7 @@ var Properties = {
248248
"cue-after" : 1,
249249
"cue-before" : 1,
250250
"cursor" : 1,
251-
251+
252252
//D
253253
"direction" : "ltr | rtl | inherit",
254254
"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 | box | inline-box | grid | inline-grid | 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",
@@ -259,16 +259,16 @@ var Properties = {
259259
"drop-initial-before-align" : "caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
260260
"drop-initial-size" : "auto | line | <length> | <percentage>",
261261
"drop-initial-value" : "initial | <integer>",
262-
262+
263263
//E
264264
"elevation" : "<angle> | below | level | above | higher | lower | inherit",
265265
"empty-cells" : "show | hide | inherit",
266-
266+
267267
//F
268268
"filter" : 1,
269269
"fit" : "fill | hidden | meet | slice",
270270
"fit-position" : 1,
271-
"float" : "left | right | none | inherit",
271+
"float" : "left | right | none | inherit",
272272
"float-offset" : 1,
273273
"font" : 1,
274274
"font-family" : 1,
@@ -278,7 +278,7 @@ var Properties = {
278278
"font-style" : "normal | italic | oblique | inherit",
279279
"font-variant" : "normal | small-caps | inherit",
280280
"font-weight" : "normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit",
281-
281+
282282
//G
283283
"grid-cell-stacking" : "columns | rows | layer",
284284
"grid-column" : 1,
@@ -293,7 +293,7 @@ var Properties = {
293293
"grid-row-align" : "start | end | center | stretch",
294294
"grid-row-span" : "<integer>",
295295
"grid-row-sizing" : 1,
296-
296+
297297
//H
298298
"hanging-punctuation" : 1,
299299
"height" : "<margin-width> | inherit",
@@ -303,14 +303,14 @@ var Properties = {
303303
"hyphenate-lines" : "no-limit | <integer>",
304304
"hyphenate-resource" : 1,
305305
"hyphens" : "none | manual | auto",
306-
306+
307307
//I
308308
"icon" : 1,
309309
"image-orientation" : "angle | auto",
310310
"image-rendering" : 1,
311311
"image-resolution" : 1,
312312
"inline-box-align" : "initial | last | <integer>",
313-
313+
314314
//L
315315
"left" : "<margin-width> | inherit",
316316
"letter-spacing" : "<length> | normal | inherit",
@@ -324,7 +324,7 @@ var Properties = {
324324
"list-style-image" : "<uri> | none | inherit",
325325
"list-style-position" : "inside | outside | inherit",
326326
"list-style-type" : "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit",
327-
327+
328328
//M
329329
"margin" : { multi: "<margin-width> | inherit", max: 4 },
330330
"margin-bottom" : "<margin-width> | inherit",
@@ -344,14 +344,14 @@ var Properties = {
344344
"min-height" : "<length> | <percentage> | inherit",
345345
"min-width" : "<length> | <percentage> | inherit",
346346
"move-to" : 1,
347-
347+
348348
//N
349349
"nav-down" : 1,
350350
"nav-index" : 1,
351351
"nav-left" : 1,
352352
"nav-right" : 1,
353353
"nav-up" : 1,
354-
354+
355355
//O
356356
"opacity" : "<number> | inherit",
357357
"orphans" : "<integer> | inherit",
@@ -362,9 +362,10 @@ var Properties = {
362362
"outline-width" : "<border-width> | inherit",
363363
"overflow" : "visible | hidden | scroll | auto | inherit",
364364
"overflow-style" : 1,
365+
"overflow-wrap" : "normal | break-word",
365366
"overflow-x" : 1,
366367
"overflow-y" : 1,
367-
368+
368369
//P
369370
"padding" : { multi: "<padding-width> | inherit", max: 4 },
370371
"padding-bottom" : "<padding-width> | inherit",
@@ -389,10 +390,10 @@ var Properties = {
389390
"position" : "static | relative | absolute | fixed | inherit",
390391
"presentation-level" : 1,
391392
"punctuation-trim" : 1,
392-
393+
393394
//Q
394395
"quotes" : 1,
395-
396+
396397
//R
397398
"rendering-intent" : 1,
398399
"resize" : 1,
@@ -407,7 +408,7 @@ var Properties = {
407408
"ruby-overhang" : 1,
408409
"ruby-position" : 1,
409410
"ruby-span" : 1,
410-
411+
411412
//S
412413
"size" : 1,
413414
"speak" : "normal | none | spell-out | inherit",
@@ -418,7 +419,7 @@ var Properties = {
418419
"src" : 1,
419420
"stress" : 1,
420421
"string-set" : 1,
421-
422+
422423
"table-layout" : "auto | fixed | inherit",
423424
"tab-size" : "<integer> | <length>",
424425
"target" : 1,
@@ -447,12 +448,12 @@ var Properties = {
447448
"transition-duration" : 1,
448449
"transition-property" : 1,
449450
"transition-timing-function" : 1,
450-
451+
451452
//U
452453
"unicode-bidi" : "normal | embed | bidi-override | inherit",
453454
"user-modify" : "read-only | read-write | write-only | inherit",
454455
"user-select" : "none | text | toggle | element | elements | all | inherit",
455-
456+
456457
//V
457458
"vertical-align" : "auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>",
458459
"visibility" : "visible | hidden | collapse | inherit",
@@ -465,17 +466,17 @@ var Properties = {
465466
"voice-stress" : 1,
466467
"voice-volume" : 1,
467468
"volume" : 1,
468-
469+
469470
//W
470471
"white-space" : "normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap", //http://perishablepress.com/wrapping-content/
471472
"white-space-collapse" : 1,
472473
"widows" : "<integer> | inherit",
473474
"width" : "<length> | <percentage> | auto | inherit" ,
474475
"word-break" : "normal | keep-all | break-all",
475476
"word-spacing" : "<length> | normal | inherit",
476-
"word-wrap" : 1,
477+
"word-wrap" : "normal | break-word",
477478
"writing-mode" : "horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb | inherit",
478-
479+
479480
//Z
480481
"z-index" : "<integer> | auto | inherit",
481482
"zoom" : "<number> | <percentage> | normal"

tests/css/Validation.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,32 @@
725725
}
726726
}));
727727

728+
suite.add(new ValidationTestCase({
729+
property: "overflow-wrap",
730+
731+
valid: [
732+
"normal",
733+
"break-word"
734+
],
735+
736+
invalid: {
737+
"foo" : "Expected (normal | break-word) but found 'foo'."
738+
}
739+
}));
740+
741+
suite.add(new ValidationTestCase({
742+
property: "word-wrap",
743+
744+
valid: [
745+
"normal",
746+
"break-word"
747+
],
748+
749+
invalid: {
750+
"foo" : "Expected (normal | break-word) but found 'foo'."
751+
}
752+
}));
753+
728754
YUITest.TestRunner.add(suite);
729755

730756
})();

0 commit comments

Comments
 (0)