forked from fidian/PrettyCSS
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtext-shadow-single.js
More file actions
66 lines (50 loc) · 1.33 KB
/
text-shadow-single.js
File metadata and controls
66 lines (50 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* <text-shadow-single>
*
* CSS3: none | [ <length>{2,3} && <color>? ]#
*
*/
"use strict";
var base = require('./base');
var util = require('../../util');
var validate = require('./validate');
var TextShadowSingle = base.baseConstructor();
util.extend(TextShadowSingle.prototype, base.base, {
name: "text-shadow-single"
});
exports.parse = function (unparsedReal, bucket, container) {
var tss = new TextShadowSingle(bucket, container, unparsedReal);
tss.debug('parse', unparsedReal);
var noneFound = false;
validate.call(tss, 'minimumCss', tss.firstToken(), 3);
if (tss.handleInherit(function () {})) {
return tss;
}
if (tss.unparsed.isContent('none')) {
noneFound = true;
tss.add(tss.unparsed.advance());
return tss;
}
var c = bucket['color'].parse(tss.unparsed, bucket, tss);
if (c) {
tss.add(c);
tss.unparsed = c.unparsed;
}
var lengths = tss.repeatParser([ bucket['length'] ], 3);
if (lengths < 2) {
tss.debug('parse fail');
return null;
}
if (! c) {
c = bucket['color'].parse(tss.unparsed, bucket, tss);
if (c) {
tss.add(c);
tss.unparsed = c.unparsed;
}
}
if (! noneFound && tss.unparsed.isContent('none')) {
tss.add(tss.unparsed.advance());
}
tss.warnIfInherit();
tss.debug('parse success', tss.unparsed);
return tss;
};