Skip to content

Commit e9a312a

Browse files
committed
Added text-rendering
1 parent 1e29e0c commit e9a312a

File tree

9 files changed

+132
-13
lines changed

9 files changed

+132
-13
lines changed

build/node-parserlib.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
24+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
2525
var parserlib = {};
2626
(function(){
2727

@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931931
THE SOFTWARE.
932932
933933
*/
934-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
934+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
935935
(function(){
936936
var EventTarget = parserlib.util.EventTarget,
937937
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -2658,6 +2658,11 @@ Parser.prototype = function(){
26582658

26592659
prio = this._prio();
26602660

2661+
/*
2662+
* If hacks should be allowed, then only check the root
2663+
* property. If hacks should not be allowed, treat
2664+
* _property or *property as invalid properties.
2665+
*/
26612666
propertyName = property.toString();
26622667
if (this.options.starHack && property.hack == "*" ||
26632668
this.options.underscoreHack && property.hack == "_") {
@@ -3854,6 +3859,7 @@ var Properties = {
38543859
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
38553860
"text-outline" : 1,
38563861
"text-overflow" : 1,
3862+
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
38573863
"text-shadow" : 1,
38583864
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
38593865
"text-wrap" : "normal | none | avoid",
@@ -5933,7 +5939,7 @@ var ValidationTypes = {
59335939
i, len, found = false;
59345940

59355941
for (i=0,len=args.length; i < len && !found; i++){
5936-
if (text == args[i]){
5942+
if (text == args[i].toLowerCase()){
59375943
found = true;
59385944
}
59395945
}
@@ -6117,6 +6123,18 @@ var ValidationTypes = {
61176123
part,
61186124
i, len;
61196125

6126+
/*
6127+
<position> = [
6128+
[ left | center | right | top | bottom | <percentage> | <length> ]
6129+
|
6130+
[ left | center | right | <percentage> | <length> ]
6131+
[ top | center | bottom | <percentage> | <length> ]
6132+
|
6133+
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
6134+
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
6135+
]
6136+
6137+
*/
61206138

61216139
if (ValidationTypes.isAny(expression, "top | bottom")) {
61226140
result = true;

build/npm/lib/node-parserlib.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
24+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
2525
var parserlib = {};
2626
(function(){
2727

@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931931
THE SOFTWARE.
932932
933933
*/
934-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
934+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
935935
(function(){
936936
var EventTarget = parserlib.util.EventTarget,
937937
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -2658,6 +2658,11 @@ Parser.prototype = function(){
26582658

26592659
prio = this._prio();
26602660

2661+
/*
2662+
* If hacks should be allowed, then only check the root
2663+
* property. If hacks should not be allowed, treat
2664+
* _property or *property as invalid properties.
2665+
*/
26612666
propertyName = property.toString();
26622667
if (this.options.starHack && property.hack == "*" ||
26632668
this.options.underscoreHack && property.hack == "_") {
@@ -3854,6 +3859,7 @@ var Properties = {
38543859
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
38553860
"text-outline" : 1,
38563861
"text-overflow" : 1,
3862+
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
38573863
"text-shadow" : 1,
38583864
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
38593865
"text-wrap" : "normal | none | avoid",
@@ -5933,7 +5939,7 @@ var ValidationTypes = {
59335939
i, len, found = false;
59345940

59355941
for (i=0,len=args.length; i < len && !found; i++){
5936-
if (text == args[i]){
5942+
if (text == args[i].toLowerCase()){
59375943
found = true;
59385944
}
59395945
}
@@ -6117,6 +6123,18 @@ var ValidationTypes = {
61176123
part,
61186124
i, len;
61196125

6126+
/*
6127+
<position> = [
6128+
[ left | center | right | top | bottom | <percentage> | <length> ]
6129+
|
6130+
[ left | center | right | <percentage> | <length> ]
6131+
[ top | center | bottom | <percentage> | <length> ]
6132+
|
6133+
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
6134+
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
6135+
]
6136+
6137+
*/
61206138

61216139
if (ValidationTypes.isAny(expression, "top | bottom")) {
61226140
result = true;

build/parserlib-core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
24+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
2525
var parserlib = {};
2626
(function(){
2727

build/parserlib-css.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
24+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
2525
(function(){
2626
var EventTarget = parserlib.util.EventTarget,
2727
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -1748,6 +1748,11 @@ Parser.prototype = function(){
17481748

17491749
prio = this._prio();
17501750

1751+
/*
1752+
* If hacks should be allowed, then only check the root
1753+
* property. If hacks should not be allowed, treat
1754+
* _property or *property as invalid properties.
1755+
*/
17511756
propertyName = property.toString();
17521757
if (this.options.starHack && property.hack == "*" ||
17531758
this.options.underscoreHack && property.hack == "_") {
@@ -2944,6 +2949,7 @@ var Properties = {
29442949
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
29452950
"text-outline" : 1,
29462951
"text-overflow" : 1,
2952+
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
29472953
"text-shadow" : 1,
29482954
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
29492955
"text-wrap" : "normal | none | avoid",
@@ -5023,7 +5029,7 @@ var ValidationTypes = {
50235029
i, len, found = false;
50245030

50255031
for (i=0,len=args.length; i < len && !found; i++){
5026-
if (text == args[i]){
5032+
if (text == args[i].toLowerCase()){
50275033
found = true;
50285034
}
50295035
}
@@ -5207,6 +5213,18 @@ var ValidationTypes = {
52075213
part,
52085214
i, len;
52095215

5216+
/*
5217+
<position> = [
5218+
[ left | center | right | top | bottom | <percentage> | <length> ]
5219+
|
5220+
[ left | center | right | <percentage> | <length> ]
5221+
[ top | center | bottom | <percentage> | <length> ]
5222+
|
5223+
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
5224+
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
5225+
]
5226+
5227+
*/
52105228

52115229
if (ValidationTypes.isAny(expression, "top | bottom")) {
52125230
result = true;

build/parserlib-tests.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,7 @@
24012401
valid: [
24022402
"top",
24032403
"bottom",
2404+
"center",
24042405
"left center",
24052406
"left 10px",
24062407
"center bottom",
@@ -2741,6 +2742,22 @@
27412742
"foo" : "Expected (<length> | <percentage> | inherit) but found 'foo'."
27422743
}
27432744
}));
2745+
2746+
suite.add(new ValidationTestCase({
2747+
property: "text-rendering",
2748+
2749+
valid: [
2750+
"auto",
2751+
"optimizeSpeed",
2752+
"optimizeLegibility",
2753+
"geometricPrecision",
2754+
"inherit"
2755+
],
2756+
2757+
invalid: {
2758+
"foo" : "Expected (auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit) but found 'foo'."
2759+
}
2760+
}));
27442761

27452762
suite.add(new ValidationTestCase({
27462763
property: "opacity",

build/parserlib.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
24+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
2525
var parserlib = {};
2626
(function(){
2727

@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931931
THE SOFTWARE.
932932
933933
*/
934-
/* Version v@VERSION@, Build time: 4-May-2012 03:29:22 */
934+
/* Version v@VERSION@, Build time: 4-May-2012 03:56:19 */
935935
(function(){
936936
var EventTarget = parserlib.util.EventTarget,
937937
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -2658,6 +2658,11 @@ Parser.prototype = function(){
26582658

26592659
prio = this._prio();
26602660

2661+
/*
2662+
* If hacks should be allowed, then only check the root
2663+
* property. If hacks should not be allowed, treat
2664+
* _property or *property as invalid properties.
2665+
*/
26612666
propertyName = property.toString();
26622667
if (this.options.starHack && property.hack == "*" ||
26632668
this.options.underscoreHack && property.hack == "_") {
@@ -3854,6 +3859,7 @@ var Properties = {
38543859
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
38553860
"text-outline" : 1,
38563861
"text-overflow" : 1,
3862+
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
38573863
"text-shadow" : 1,
38583864
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
38593865
"text-wrap" : "normal | none | avoid",
@@ -5933,7 +5939,7 @@ var ValidationTypes = {
59335939
i, len, found = false;
59345940

59355941
for (i=0,len=args.length; i < len && !found; i++){
5936-
if (text == args[i]){
5942+
if (text == args[i].toLowerCase()){
59375943
found = true;
59385944
}
59395945
}
@@ -6117,6 +6123,18 @@ var ValidationTypes = {
61176123
part,
61186124
i, len;
61196125

6126+
/*
6127+
<position> = [
6128+
[ left | center | right | top | bottom | <percentage> | <length> ]
6129+
|
6130+
[ left | center | right | <percentage> | <length> ]
6131+
[ top | center | bottom | <percentage> | <length> ]
6132+
|
6133+
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
6134+
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
6135+
]
6136+
6137+
*/
61206138

61216139
if (ValidationTypes.isAny(expression, "top | bottom")) {
61226140
result = true;

src/css/Properties.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ var Properties = {
433433
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
434434
"text-outline" : 1,
435435
"text-overflow" : 1,
436+
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
436437
"text-shadow" : 1,
437438
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
438439
"text-wrap" : "normal | none | avoid",

src/css/ValidationTypes.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var ValidationTypes = {
88
i, len, found = false;
99

1010
for (i=0,len=args.length; i < len && !found; i++){
11-
if (text == args[i]){
11+
if (text == args[i].toLowerCase()){
1212
found = true;
1313
}
1414
}
@@ -192,6 +192,18 @@ var ValidationTypes = {
192192
part,
193193
i, len;
194194

195+
/*
196+
<position> = [
197+
[ left | center | right | top | bottom | <percentage> | <length> ]
198+
|
199+
[ left | center | right | <percentage> | <length> ]
200+
[ top | center | bottom | <percentage> | <length> ]
201+
|
202+
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
203+
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
204+
]
205+
206+
*/
195207

196208
if (ValidationTypes.isAny(expression, "top | bottom")) {
197209
result = true;

tests/css/Validation.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
valid: [
153153
"top",
154154
"bottom",
155+
"center",
155156
"left center",
156157
"left 10px",
157158
"center bottom",
@@ -492,6 +493,22 @@
492493
"foo" : "Expected (<length> | <percentage> | inherit) but found 'foo'."
493494
}
494495
}));
496+
497+
suite.add(new ValidationTestCase({
498+
property: "text-rendering",
499+
500+
valid: [
501+
"auto",
502+
"optimizeSpeed",
503+
"optimizeLegibility",
504+
"geometricPrecision",
505+
"inherit"
506+
],
507+
508+
invalid: {
509+
"foo" : "Expected (auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit) but found 'foo'."
510+
}
511+
}));
495512

496513
suite.add(new ValidationTestCase({
497514
property: "opacity",

0 commit comments

Comments
 (0)