-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathparser-lib.node.txt
83 lines (78 loc) · 5.5 KB
/
parser-lib.node.txt
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
┏━━━━━━━━━━━━━━━━┓
┃ PARSER-LIB ┃
┗━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See PostCSS
VERSION ==> #0.2.5
#CSS parser. As Node module or in browser.
new PARSERLIB.css.Parser([OPTS]) #Returns PARSER.
#OPTS:
# - strict BOOL (def: false): do not throw on parse error
# - starHack BOOL (def: false): understand IE<=7 hack where *PROP can be used
# - underscoreHack BOOL (def: false): same for _PROP and IE<=6
# - ieFilters BOOL (def: false): understand IE<=8 filter PROP
PARSER.addListener('EVENT', FUNC) #
PARSER.parse('CSS') #Fires events:
# - all have EVENT:
# - type 'EVENT'
# - all objects have: line|col NUM
# - 'start|endstylesheet': beginning|end
# - 'charset': @charset, with EVENT: charset STR
# - 'namespace': @namespace, with EVENT: prefix STR, uri STR
# - 'import': @import, with EVENT:
# - uri STR
# - media MEDIAQUERY_ARR:
# - modifier 'not|only|'
# - mediaType 'MEDIA'
# - features FEATURE_ARR:
# - name 'VAR'
# - value 'VAL'
# - 'start|endfontface': @font-face
# - 'start|endpage': @page, with EVENT: id STR, pseudo STR
# - 'start|endpagemargin': like @top-left, with EVENT: margin STR
# - 'start|endmedia': @media, with EVENT: media MEDIAQUERY_ARR
# - 'start|endkeyframes': @keyframes, with EVENT: name STR
# - 'start|endrule': normal ruleset, with EVENT: selectors SELECTOR_ARR:
# - selectors SELECTORS_ARR:
# - text 'SELECTORS'
# - type ENUM, among PARSERLIB.css.Parser
# - parts SELECTORPART|COMBINATOR_ARR:
# (SELECTORPART):
# - text 'SELECTOR'
# - type ENUM, among PARSERLIB.css.Parser
# - elementName null|SUBPART (has toString()):
# - type 'elementName|class|attribute|pseudo|id|not'
# - args SUBPART_ARR: if type is 'not'
# - modifiers SUBPART_ARR (has toString())
# (COMBINATOR):
# - type 'descendant|child|sibling|ascendant-sibling'
# - text STR, e.g. '>' or ' '
# - specificity: a|b|c|d NUM
# - 'property': normal ruleset property, with EVENT:
# - property PROP_NAME:
# - hack '*|_'|null: see starHack|underscoreHack
# - text: 'PROP'
# - type ENUM
# - value PROP_VAL:
# - text 'VAL,...'
# - type ENUM among PARSERLIB.css.Tokens
# - parts PART_ARR:
# - text 'VAL'
# - type 'dimension|percentage|integer|number|color|uri|string|identifier|operator|unkwown'
# operator is e.g. '/'
# identifier is enum value
# (color)
# - red|green|blue|alpha NUM
# (dimension|integer|percentage|number)
# - value NUM
# (dimension)
# - units STR
# (uri)
# - uri STR
# (string|identifier)
# - value STR
# - important BOOL
# - invalid null|OBJ: invalid syntax
# - message STR
# - 'error': recoverable error:
# - invalid syntax will skip the rule or ruleset
# - with EVENT: message STR