annotate runtime/autoload/javascriptcomplete.vim @ 9546:271f3ae34835 v7.4.2053

commit https://github.com/vim/vim/commit/e21d62435ef966b8adb40dee13ef9d6791316674 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 16 20:43:14 2016 +0200 patch 7.4.2053 Problem: Can't run scripttests in the top directory. Solution: Add targets to the top Makefile.
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Jul 2016 20:45:10 +0200
parents 8cd729851562
children 1218c5353e2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
1 " Vim completion script
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
2 " Language: Java Script
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
3 " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
856
8cd729851562 updated for version 7.0g
vimboss
parents: 667
diff changeset
4 " Last Change: 2006 Apr 30
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
5
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
6 function! javascriptcomplete#CompleteJS(findstart, base)
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
7 if a:findstart
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
8 " locate the start of the word
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
9 let line = getline('.')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
10 let start = col('.') - 1
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
11 let curline = line('.')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
12 let compl_begin = col('.') - 2
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
13 " Bit risky but JS is rather limited language and local chars shouldn't
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
14 " fint way into names
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
15 while start >= 0 && line[start - 1] =~ '\k'
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
16 let start -= 1
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
17 endwhile
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
18 let b:compl_context = getline('.')[0:compl_begin]
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
19 return start
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
20 else
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
21 " Initialize base return lists
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
22 let res = []
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
23 let res2 = []
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
24 " a:base is very short - we need context
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
25 " Shortcontext is context without a:base, useful for checking if we are
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
26 " looking for objects and for what objects we are looking for
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
27 let context = b:compl_context
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
28 let shortcontext = substitute(context, a:base.'$', '', '')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
29 unlet! b:compl_context
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
30
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
31 if exists("b:jsrange")
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
32 let file = getline(b:jsrange[0],b:jsrange[1])
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
33 unlet! b:jsrange
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
34
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
35 if len(b:js_extfiles) > 0
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
36 let file = b:js_extfiles + file
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
37 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
38
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
39 else
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
40 let file = getline(1, '$')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
41 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
42
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
43
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
44 " Completion of properties, methods, etc. {{{
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
45 if shortcontext =~ '\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
46 " Complete methods and properties for objects
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
47 " DOM separate
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
48 let doms = ['style.']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
49 " Arrays
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
50 let arrayprop = ['constructor', 'index', 'input', 'length', 'prototype']
856
8cd729851562 updated for version 7.0g
vimboss
parents: 667
diff changeset
51 let arraymeth = ['concat', 'join', 'pop', 'push', 'reverse', 'shift',
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
52 \ 'splice', 'sort', 'toSource', 'toString', 'unshift', 'valueOf',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
53 \ 'watch', 'unwatch']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
54 call map(arraymeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
55 let arrays = arrayprop + arraymeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
56
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
57 " Boolean - complete subset of array values
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
58 " properties - constructor, prototype
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
59 " methods - toSource, toString, valueOf
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
60
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
61 " Date
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
62 " properties - constructor, prototype
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
63 let datemeth = ['getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
64 \ 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
65 \ 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
66 \ 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
67 \ 'getYear', 'parse', 'parse',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
68 \ 'setDate', 'setDay', 'setFullYear', 'setHours', 'setMilliseconds',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
69 \ 'setMinutes', 'setMonth', 'setSeconds',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
70 \ 'setUTCDate', 'setUTCDay', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
71 \ 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'setTime',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
72 \ 'toGMTString', 'toLocaleString', 'toLocaleDateString', 'toLocaleTimeString',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
73 \ 'toSource', 'toString', 'toUTCString', 'UTC', 'valueOf', 'watch', 'unwatch']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
74 call map(datemeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
75 let dates = datemeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
76
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
77 " Function
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
78 let funcprop = ['arguments', 'arguments.callee', 'arguments.caller', 'arguments.length',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
79 \ 'arity', 'constructor', 'length', 'prototype']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
80 let funcmeth = ['apply', 'call', 'toSource', 'toString', 'valueOf']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
81 call map(funcmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
82 let funcs = funcprop + funcmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
83
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
84 " Math
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
85 let mathprop = ['E', 'LN2', 'LN10', 'LOG2E', 'LOG10E', 'PI', 'SQRT1_2', 'SQRT']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
86 let mathmeth = ['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
87 \ 'log', 'max', 'min', 'pow', 'random', 'round', 'sin', 'sqrt', 'tan',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
88 \ 'watch', 'unwatch']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
89 call map(mathmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
90 let maths = mathprop + mathmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
91
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
92 " Number
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
93 let numbprop = ['MAX_VALUE', 'MIN_VALUE', 'NaN', 'NEGATIVE_INFINITY', 'POSITIVE_INFINITY',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
94 \ 'constructor', 'prototype']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
95 let numbmeth = ['toExponential', 'toFixed', 'toPrecision', 'toSource', 'toString', 'valueOf',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
96 \ 'watch', 'unwatch']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
97 call map(numbmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
98 let numbs = numbprop + numbmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
99
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
100 " Object
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
101 let objeprop = ['constructor', 'prototype']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
102 let objemeth = ['eval', 'toSource', 'toString', 'unwatch', 'watch', 'valueOf']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
103 call map(objemeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
104 let objes = objeprop + objemeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
105
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
106 " RegExp
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
107 let regeprop = ['constructor', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'prototype']
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
108 let regemeth = ['exec', 'test', 'toSource', 'toString', 'watch', 'unwatch']
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
109 call map(regemeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
110 let reges = regeprop + regemeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
111
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
112 " String
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
113 let striprop = ['constructor', 'length', 'prototype']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
114 let strimeth = ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
115 \ 'fixed', 'fontcolor', 'fontsize', 'fromCharCode', 'indexOf', 'italics',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
116 \ 'lastIndexOf', 'link', 'match', 'replace', 'search', 'slice', 'small',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
117 \ 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLowerCase',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
118 \ 'toSource', 'toString', 'toUpperCase', 'watch', 'unwatch']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
119 call map(strimeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
120 let stris = striprop + strimeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
121
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
122 " User created properties
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
123 let user_props1 = filter(copy(file), 'v:val =~ "this\\.\\k"')
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
124 let juser_props1 = join(user_props1, ' ')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
125 let user_props1 = split(juser_props1, '\zethis\.')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
126 unlet! juser_props1
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
127 call map(user_props1, 'matchstr(v:val, "this\\.\\zs\\k\\+\\ze")')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
128
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
129 let user_props2 = filter(copy(file), 'v:val =~ "\\.prototype\\.\\k"')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
130 let juser_props2 = join(user_props2, ' ')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
131 let user_props2 = split(juser_props2, '\zeprototype\.')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
132 unlet! juser_props2
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
133 call map(user_props2, 'matchstr(v:val, "prototype\\.\\zs\\k\\+\\ze")')
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
134 let user_props = user_props1 + user_props2
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
135
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
136 " HTML DOM properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
137 " Anchors - anchor.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
138 let anchprop = ['accessKey', 'charset', 'coords', 'href', 'hreflang', 'id', 'innerHTML',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
139 \ 'name', 'rel', 'rev', 'shape', 'tabIndex', 'target', 'type', 'onBlur', 'onFocus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
140 let anchmeth = ['blur', 'focus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
141 call map(anchmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
142 let anths = anchprop + anchmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
143 " Area - area.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
144 let areaprop = ['accessKey', 'alt', 'coords', 'hash', 'host', 'hostname', 'href', 'id',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
145 \ 'noHref', 'pathname', 'port', 'protocol', 'search', 'shape', 'tabIndex', 'target']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
146 let areameth = ['onClick', 'onDblClick', 'onMouseOut', 'onMouseOver']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
147 call map(areameth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
148 let areas = areaprop + areameth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
149 " Base - base.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
150 let baseprop = ['href', 'id', 'target']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
151 let bases = baseprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
152 " Body - body.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
153 let bodyprop = ['aLink', 'background', 'gbColor', 'id', 'link', 'scrollLeft', 'scrollTop',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
154 \ 'text', 'vLink']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
155 let bodys = bodyprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
156 " Document - document.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
157 let docuprop = ['anchors', 'applets', 'childNodes', 'embeds', 'forms', 'images', 'links', 'stylesheets',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
158 \ 'body', 'cookie', 'documentElement', 'domain', 'lastModified', 'referrer', 'title', 'URL']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
159 let documeth = ['close', 'createAttribute', 'createElement', 'createTextNode', 'focus', 'getElementById',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
160 \ 'getElementsByName', 'getElementsByTagName', 'open', 'write', 'writeln',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
161 \ 'onClick', 'onDblClick', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
162 \ 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onResize']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
163 call map(documeth, 'v:val."("')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
164 let docuxprop = ['attributes', 'childNodes', 'doctype', 'documentElement', 'firstChild',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
165 \ 'implementation', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
166 \ 'nodeValue', 'ownerDocument', 'parentNode', 'previousSibling']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
167 let docuxmeth = ['createAttribute', 'createCDATASection',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
168 \ 'createComment', 'createDocument', 'createDocumentFragment',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
169 \ 'createElement', 'createEntityReference', 'createProcessingInstruction',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
170 \ 'createTextNode']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
171 call map(docuxmeth, 'v:val."("')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
172 let docus = docuprop + docuxprop + documeth + docuxmeth
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
173 " Form - form.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
174 let formprop = ['elements', 'acceptCharset', 'action', 'encoding', 'enctype', 'id', 'length',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
175 \ 'method', 'name', 'tabIndex', 'target']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
176 let formmeth = ['reset', 'submit', 'onReset', 'onSubmit']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
177 call map(formmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
178 let forms = formprop + formmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
179 " Frame - frame.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
180 let framprop = ['contentDocument', 'frameBorder', 'id', 'longDesc', 'marginHeight', 'marginWidth',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
181 \ 'name', 'noResize', 'scrolling', 'src']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
182 let frammeth = ['blur', 'focus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
183 call map(frammeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
184 let frams = framprop + frammeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
185 " Frameset - frameset.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
186 let fsetprop = ['cols', 'id', 'rows']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
187 let fsetmeth = ['blur', 'focus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
188 call map(fsetmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
189 let fsets = fsetprop + fsetmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
190 " History - history.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
191 let histprop = ['length']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
192 let histmeth = ['back', 'forward', 'go']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
193 call map(histmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
194 let hists = histprop + histmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
195 " Iframe - iframe.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
196 let ifraprop = ['align', 'frameBorder', 'height', 'id', 'longDesc', 'marginHeight', 'marginWidth',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
197 \ 'name', 'scrolling', 'src', 'width']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
198 let ifras = ifraprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
199 " Image - image.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
200 let imagprop = ['align', 'alt', 'border', 'complete', 'height', 'hspace', 'id', 'isMap', 'longDesc',
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
201 \ 'lowSrc', 'name', 'src', 'useMap', 'vspace', 'width']
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
202 let imagmeth = ['onAbort', 'onError', 'onLoad']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
203 call map(imagmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
204 let imags = histprop + imagmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
205 " Button - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
206 let buttprop = ['accessKey', 'disabled', 'form', 'id', 'name', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
207 let buttmeth = ['blur', 'click', 'focus', 'onBlur', 'onClick', 'onFocus', 'onMouseDown', 'onMouseUp']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
208 call map(buttmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
209 let butts = buttprop + buttmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
210 " Checkbox - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
211 let checprop = ['accept', 'accessKey', 'align', 'alt', 'checked', 'defaultChecked',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
212 \ 'disabled', 'form', 'id', 'name', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
213 let checmeth = ['blur', 'click', 'focus', 'onBlur', 'onClick', 'onFocus', 'onMouseDown', 'onMouseUp']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
214 call map(checmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
215 let checs = checprop + checmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
216 " File upload - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
217 let fileprop = ['accept', 'accessKey', 'align', 'alt', 'defaultValue',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
218 \ 'disabled', 'form', 'id', 'name', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
219 let filemeth = ['blur', 'focus', 'onBlur', 'onClick', 'onFocus', 'onMouseDown', 'onMouseUp']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
220 call map(filemeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
221 let files = fileprop + filemeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
222 " Hidden - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
223 let hiddprop = ['defaultValue', 'form', 'id', 'name', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
224 let hidds = hiddprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
225 " Password - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
226 let passprop = ['accept', 'accessKey', 'defaultValue',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
227 \ 'disabled', 'form', 'id', 'maxLength', 'name', 'readOnly', 'size', 'tabIndex',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
228 \ 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
229 let passmeth = ['blur', 'click', 'focus', 'select', 'onBlur', 'onFocus', 'onKeyDown',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
230 \ 'onKeyPress', 'onKeyUp']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
231 call map(passmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
232 let passs = passprop + passmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
233 " Radio - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
234 let radiprop = ['accept', 'accessKey', 'align', 'alt', 'checked', 'defaultChecked',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
235 \ 'disabled', 'form', 'id', 'name', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
236 let radimeth = ['blur', 'click', 'focus', 'select', 'onBlur', 'onFocus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
237 call map(radimeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
238 let radis = radiprop + radimeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
239 " Reset - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
240 let reseprop = ['accept', 'accessKey', 'align', 'alt', 'defaultValue',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
241 \ 'disabled', 'form', 'id', 'name', 'size', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
242 let resemeth = ['blur', 'click', 'focus', 'select', 'onBlur', 'onFocus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
243 call map(resemeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
244 let reses = reseprop + resemeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
245 " Submit - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
246 let submprop = ['accept', 'accessKey', 'align', 'alt', 'defaultValue',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
247 \ 'disabled', 'form', 'id', 'name', 'size', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
248 let submmeth = ['blur', 'click', 'focus', 'select', 'onClick', 'onSelectStart']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
249 call map(submmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
250 let subms = submprop + submmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
251 " Text - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
252 let textprop = ['accept', 'accessKey', 'align', 'alt', 'defaultValue',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
253 \ 'disabled', 'form', 'id', 'maxLength', 'name', 'readOnly',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
254 \ 'size', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
255 let textmeth = ['blur', 'focus', 'select', 'onBlur', 'onChange', 'onFocus', 'onKeyDown',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
256 \ 'onKeyPress', 'onKeyUp', 'onSelect']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
257 call map(textmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
258 let texts = textprop + textmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
259 " Link - link.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
260 let linkprop = ['charset', 'disabled', 'href', 'hreflang', 'id', 'media',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
261 \ 'rel', 'rev', 'target', 'type']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
262 let linkmeth = ['onLoad']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
263 call map(linkmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
264 let links = linkprop + linkmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
265 " Location - location.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
266 let locaprop = ['href', 'hash', 'host', 'hostname', 'pathname', 'port', 'protocol',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
267 \ 'search']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
268 let locameth = ['assign', 'reload', 'replace']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
269 call map(locameth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
270 let locas = locaprop + locameth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
271 " Meta - meta.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
272 let metaprop = ['charset', 'content', 'disabled', 'httpEquiv', 'name', 'scheme']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
273 let metas = metaprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
274 " Navigator - navigator.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
275 let naviprop = ['plugins', 'appCodeName', 'appName', 'appVersion', 'cookieEnabled',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
276 \ 'platform', 'userAgent']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
277 let navimeth = ['javaEnabled', 'taintEnabled']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
278 call map(navimeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
279 let navis = naviprop + navimeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
280 " Object - object.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
281 let objeprop = ['align', 'archive', 'border', 'code', 'codeBase', 'codeType', 'data',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
282 \ 'declare', 'form', 'height', 'hspace', 'id', 'name', 'standby', 'tabIndex',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
283 \ 'type', 'useMap', 'vspace', 'width']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
284 let objes = objeprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
285 " Option - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
286 let optiprop = ['defaultSelected',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
287 \ 'disabled', 'form', 'id', 'index', 'label', 'selected', 'text', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
288 let optis = optiprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
289 " Screen - screen.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
290 let screprop = ['availHeight', 'availWidth', 'colorDepth', 'height', 'width']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
291 let scres = screprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
292 " Select - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
293 let seleprop = ['options', 'disabled', 'form', 'id', 'length', 'multiple', 'name',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
294 \ 'selectedIndex', 'size', 'tabIndex', 'type', 'value']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
295 let selemeth = ['blur', 'focus', 'remove', 'onBlur', 'onChange', 'onFocus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
296 call map(selemeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
297 let seles = seleprop + selemeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
298 " Style - style.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
299 let stylprop = ['background', 'backgroundAttachment', 'backgroundColor', 'backgroundImage',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
300 \ 'backgroundPosition', 'backgroundRepeat',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
301 \ 'border', 'borderBottom', 'borderLeft', 'borderRight', 'borderTop',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
302 \ 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
303 \ 'borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
304 \ 'borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth',
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
305 \ 'borderColor', 'borderStyle', 'borderWidth', 'margin', 'marginBottom',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
306 \ 'marginLeft', 'marginRight', 'marginTop', 'outline', 'outlineStyle', 'outlineWidth',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
307 \ 'outlineColor', 'outlineStyle', 'outlineWidth', 'padding', 'paddingBottom',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
308 \ 'paddingLeft', 'paddingRight', 'paddingTop',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
309 \ 'clear', 'clip', 'clipBottom', 'clipLeft', 'clipRight', 'clipTop', 'content',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
310 \ 'counterIncrement', 'counterReset', 'cssFloat', 'cursor', 'direction',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
311 \ 'display', 'markerOffset', 'marks', 'maxHeight', 'maxWidth', 'minHeight',
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
312 \ 'minWidth', 'overflow', 'overflowX', 'overflowY', 'verticalAlign', 'visibility',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
313 \ 'width',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
314 \ 'listStyle', 'listStyleImage', 'listStylePosition', 'listStyleType',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
315 \ 'cssText', 'bottom', 'height', 'left', 'position', 'right', 'top', 'width', 'zindex',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
316 \ 'orphans', 'widows', 'page', 'pageBreakAfter', 'pageBreakBefore', 'pageBreakInside',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
317 \ 'borderCollapse', 'borderSpacing', 'captionSide', 'emptyCells', 'tableLayout',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
318 \ 'color', 'font', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
319 \ 'fontStyle', 'fontVariant', 'fontWeight', 'letterSpacing', 'lineHeight', 'quotes',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
320 \ 'textAlign', 'textIndent', 'textShadow', 'textTransform', 'textUnderlinePosition',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
321 \ 'unicodeBidi', 'whiteSpace', 'wordSpacing']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
322 let styls = stylprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
323 " Table - table.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
324 let tablprop = ['rows', 'tBodies', 'align', 'bgColor', 'border', 'caption', 'cellPadding',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
325 \ 'cellSpacing', 'frame', 'height', 'rules', 'summary', 'tFoot', 'tHead', 'width']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
326 let tablmeth = ['createCaption', 'createTFoot', 'createTHead', 'deleteCaption', 'deleteRow',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
327 \ 'deleteTFoot', 'deleteTHead', 'insertRow']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
328 call map(tablmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
329 let tabls = tablprop + tablmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
330 " Table data - TableData.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
331 let tdatprop = ['abbr', 'align', 'axis', 'bgColor', 'cellIndex', 'ch', 'chOff',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
332 \ 'colSpan', 'headers', 'noWrap', 'rowSpan', 'scope', 'vAlign', 'width']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
333 let tdats = tdatprop
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
334 " Table row - TableRow.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
335 let trowprop = ['cells', 'align', 'bgColor', 'ch', 'chOff', 'rowIndex', 'sectionRowIndex',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
336 \ 'vAlign']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
337 let trowmeth = ['deleteCell', 'insertCell']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
338 call map(trowmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
339 let trows = trowprop + trowmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
340 " Textarea - accessible only by other properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
341 let tareprop = ['accessKey', 'cols', 'defaultValue',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
342 \ 'disabled', 'form', 'id', 'name', 'readOnly', 'rows',
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
343 \ 'tabIndex', 'type', 'value', 'selectionStart', 'selectionEnd']
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
344 let taremeth = ['blur', 'focus', 'select', 'onBlur', 'onChange', 'onFocus']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
345 call map(taremeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
346 let tares = tareprop + taremeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
347 " Window - window.
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
348 let windprop = ['frames', 'closed', 'defaultStatus', 'encodeURI', 'event', 'history',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
349 \ 'length', 'location', 'name', 'onload', 'opener', 'parent', 'screen', 'self',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
350 \ 'status', 'top', 'XMLHttpRequest', 'ActiveXObject']
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
351 let windmeth = ['alert', 'blur', 'clearInterval', 'clearTimeout', 'close', 'confirm', 'focus',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
352 \ 'moveBy', 'moveTo', 'open', 'print', 'prompt', 'scrollBy', 'scrollTo', 'setInterval',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
353 \ 'setTimeout']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
354 call map(windmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
355 let winds = windprop + windmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
356 " XMLHttpRequest - access by new xxx()
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
357 let xmlhprop = ['onreadystatechange', 'readyState', 'responseText', 'responseXML',
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
358 \ 'status', 'statusText', 'parseError']
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
359 let xmlhmeth = ['abort', 'getAllResponseHeaders', 'getResponseHeaders', 'open',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
360 \ 'send', 'setRequestHeader']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
361 call map(xmlhmeth, 'v:val."("')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
362 let xmlhs = xmlhprop + xmlhmeth
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
363
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
364 " XML DOM
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
365 " Attributes - element.attributes[x].
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
366 let xdomattrprop = ['name', 'specified', 'value']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
367 " Element - anyelement.
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
368 let xdomelemprop = ['attributes', 'childNodes', 'firstChild', 'lastChild',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
369 \ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
370 \ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
371 let xdomelemmeth = ['appendChild', 'cloneNode', 'getAttribute', 'getAttributeNode',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
372 \ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', 'normalize',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
373 \ 'removeAttribute', 'removeAttributeNode', 'removeChild', 'replaceChild',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
374 \ 'setAttribute', 'setAttributeNode']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
375 call map(xdomelemmeth, 'v:val."("')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
376 let xdomelems = xdomelemprop + xdomelemmeth
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
377 " Node - anynode.
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
378 let xdomnodeprop = ['attributes', 'childNodes', 'firstChild', 'lastChild',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
379 \ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
380 \ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
381 let xdomnodemeth = ['appendChild', 'cloneNode',
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
382 \ 'hasChildNodes', 'insertBefore', 'removeChild', 'replaceChild']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
383 call map(xdomnodemeth, 'v:val."("')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
384 let xdomnodes = xdomnodeprop + xdomnodemeth
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
385 " NodeList
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
386 let xdomnliss = ['length', 'item(']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
387 " Error - parseError.
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
388 let xdomerror = ['errorCode', 'reason', 'line', 'linepos', 'srcText', 'url', 'filepos']
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
389
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
390 " Find object type declaration to reduce number of suggestions. {{{
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
391 " 1. Get object name
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
392 " 2. Find object declaration line
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
393 " 3. General declaration follows "= new Type" syntax, additional else
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
394 " for regexp "= /re/"
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
395 " 4. Make correction for Microsoft.XMLHTTP ActiveXObject
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
396 " 5. Repeat for external files
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
397 let object = matchstr(shortcontext, '\zs\k\+\ze\(\[.\{-}\]\)\?\.$')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
398 if len(object) > 0
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
399 let decl_line = search(object.'.\{-}=\s*new\s*', 'bn')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
400 if decl_line > 0
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
401 let object_type = matchstr(getline(decl_line), object.'.\{-}=\s*new\s*\zs\k\+\ze')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
402 if object_type == 'ActiveXObject' && matchstr(getline(decl_line), object.'.\{-}=\s*new\s*ActiveXObject\s*(.Microsoft\.XMLHTTP.)') != ''
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
403 let object_type = 'XMLHttpRequest'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
404 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
405 else
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
406 let decl_line = search('var\s*'.object.'\s*=\s*\/', 'bn')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
407 if decl_line > 0
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
408 let object_type = 'RegExp'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
409 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
410 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
411 " We didn't find var declaration in current file but we may have
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
412 " something in external files.
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
413 if decl_line == 0 && exists("b:js_extfiles")
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
414 let dext_line = filter(copy(b:js_extfiles), 'v:val =~ "'.object.'.\\{-}=\\s*new\\s*"')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
415 if len(dext_line) > 0
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
416 let object_type = matchstr(dext_line[-1], object.'.\{-}=\s*new\s*\zs\k\+\ze')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
417 if object_type == 'ActiveXObject' && matchstr(dext_line[-1], object.'.\{-}=\s*new\s*ActiveXObject\s*(.Microsoft\.XMLHTTP.)') != ''
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
418 let object_type = 'XMLHttpRequest'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
419 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
420 else
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
421 let dext_line = filter(copy(b:js_extfiles), 'v:val =~ "var\s*'.object.'\\s*=\\s*\\/"')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
422 if len(dext_line) > 0
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
423 let object_type = 'RegExp'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
424 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
425 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
426 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
427 endif
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
428 " }}}
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
429
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
430 if !exists('object_type')
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
431 let object_type = ''
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
432 endif
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
433
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
434 if object_type == 'Date'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
435 let values = dates
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
436 elseif object_type == 'Image'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
437 let values = imags
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
438 elseif object_type == 'Array'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
439 let values = arrays
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
440 elseif object_type == 'Boolean'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
441 " TODO: a bit more than real boolean
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
442 let values = arrays
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
443 elseif object_type == 'XMLHttpRequest'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
444 let values = xmlhs
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
445 elseif object_type == 'String'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
446 let values = stris
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
447 elseif object_type == 'RegExp'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
448 let values = reges
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
449 elseif object_type == 'Math'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
450 let values = maths
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
451 endif
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
452
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
453 if !exists('values')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
454 " List of properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
455 if shortcontext =~ 'Math\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
456 let values = maths
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
457 elseif shortcontext =~ 'anchors\(\[.\{-}\]\)\?\.$'
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
458 let values = anths
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
459 elseif shortcontext =~ 'area\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
460 let values = areas
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
461 elseif shortcontext =~ 'base\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
462 let values = bases
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
463 elseif shortcontext =~ 'body\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
464 let values = bodys
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
465 elseif shortcontext =~ 'document\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
466 let values = docus
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
467 elseif shortcontext =~ 'forms\(\[.\{-}\]\)\?\.$'
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
468 let values = forms
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
469 elseif shortcontext =~ 'frameset\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
470 let values = fsets
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
471 elseif shortcontext =~ 'history\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
472 let values = hists
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
473 elseif shortcontext =~ 'iframe\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
474 let values = ifras
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
475 elseif shortcontext =~ 'images\(\[.\{-}\]\)\?\.$'
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
476 let values = imags
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
477 elseif shortcontext =~ 'links\(\[.\{-}\]\)\?\.$'
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
478 let values = links
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
479 elseif shortcontext =~ 'location\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
480 let values = locas
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
481 elseif shortcontext =~ 'meta\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
482 let values = metas
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
483 elseif shortcontext =~ 'navigator\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
484 let values = navis
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
485 elseif shortcontext =~ 'object\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
486 let values = objes
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
487 elseif shortcontext =~ 'screen\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
488 let values = scres
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
489 elseif shortcontext =~ 'style\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
490 let values = styls
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
491 elseif shortcontext =~ 'table\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
492 let values = tabls
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
493 elseif shortcontext =~ 'TableData\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
494 let values = tdats
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
495 elseif shortcontext =~ 'TableRow\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
496 let values = trows
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
497 elseif shortcontext =~ 'window\.$'
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
498 let values = winds
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
499 elseif shortcontext =~ 'parseError\.$'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
500 let values = xdomerror
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
501 elseif shortcontext =~ 'attributes\[\d\+\]\.$'
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
502 let values = xdomattrprop
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
503 else
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
504 let values = user_props + arrays + dates + funcs + maths + numbs + objes + reges + stris
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
505 let values += doms + anths + areas + bases + bodys + docus + forms + frams + fsets + hists
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
506 let values += ifras + imags + links + locas + metas + navis + objes + scres
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
507 let values += tabls + trows + tares + winds
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
508 let values += xdomnodes + xdomnliss + xdomelems
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
509 endif
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
510 endif
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
511
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
512 for m in values
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
513 if m =~? '^'.a:base
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
514 call add(res, m)
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
515 elseif m =~? a:base
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
516 call add(res2, m)
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
517 endif
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
518 endfor
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
519
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
520 unlet! values
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
521 return res + res2
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
522
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
523 endif
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
524 " }}}
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
525
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
526 " Get variables data.
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
527 let variables = filter(copy(file), 'v:val =~ "var\\s"')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
528 call map(variables, 'matchstr(v:val, ".\\{-}var\\s\\+\\zs.*\\ze")')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
529 call map(variables, 'substitute(v:val, ";\\|$", ",", "g")')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
530 let vars = []
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
531 " This loop (and next one) is necessary to get variable names from
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
532 " constructs like: var var1, var2, var3 = "something";
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
533 for i in range(len(variables))
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
534 let comma_separated = split(variables[i], ',\s*')
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
535 call map(comma_separated, 'matchstr(v:val, "\\k\\+")')
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
536 let vars += comma_separated
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
537 endfor
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
538
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
539 let variables = sort(vars)
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
540 unlet! vars
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
541
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
542 " Add "no var" variables.
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
543 let undeclared_variables = filter(copy(file), 'v:val =~ "^\\s*\\k\\+\\s*="')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
544 let u_vars = []
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
545 for i in range(len(undeclared_variables))
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
546 let split_equal = split(undeclared_variables[i], '\s*=')
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
547 call map(split_equal, 'matchstr(v:val, "\\k\\+$")')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
548 let u_vars += split_equal
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
549 endfor
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
550
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
551 let variables += sort(u_vars)
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
552 unlet! u_vars
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
553
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
554 " Get functions
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
555 let functions = filter(copy(file), 'v:val =~ "^\\s*function\\s"')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
556 let arguments = copy(functions)
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
557 call map(functions, 'matchstr(v:val, "^\\s*function\\s\\+\\zs\\k\\+")')
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
558 call map(functions, 'v:val."("')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
559 let functions = sort(functions)
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
560
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
561 " Create table to keep arguments for additional 'menu' info
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
562 let b:js_menuinfo = {}
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
563 for i in arguments
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
564 let g:ia = i
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
565 let f_elements = matchlist(i, 'function\s\+\(\k\+\)\s*(\(.\{-}\))')
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
566 if len(f_elements) == 3
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
567 let b:js_menuinfo[f_elements[1].'('] = f_elements[2]
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
568 endif
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
569 endfor
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
570
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
571 " Get functions arguments
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
572 call map(arguments, 'matchstr(v:val, "function.\\{-}(\\zs.\\{-}\\ze)")')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
573 let jargs = join(arguments, ',')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
574 let jargs = substitute(jargs, '\s', '', 'g')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
575 let arguments = split(jargs, ',')
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
576 let arguments = sort(arguments)
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
577
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
578 " Built-in functions
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
579 let builtin = ['alert(', 'confirm(']
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
580
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
581 " Top-level HTML DOM objects
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
582 let htmldom = ['document', 'anchor', 'area', 'base', 'body', 'document', 'event', 'form', 'frame', 'frameset', 'history', 'iframe', 'image', 'input', 'link', 'location', 'meta', 'navigator', 'object', 'option', 'screen', 'select', 'table', 'tableData', 'tableHeader', 'tableRow', 'textarea', 'window']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
583 call map(htmldom, 'v:val."."')
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
584
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
585 " Top-level properties
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
586 let properties = ['decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
587 \ 'eval', 'Infinity', 'isFinite', 'isNaN', 'NaN', 'Number', 'parseFloat',
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
588 \ 'parseInt', 'String', 'undefined', 'escape', 'unescape']
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
589
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
590 " Keywords
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
591 let keywords = ["Array", "Boolean", "Date", "Function", "Math", "Number", "Object", "RegExp", "String", "XMLHttpRequest", "ActiveXObject", "abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double ", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in ", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super ", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with"]
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
592
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
593 let values = variables + functions + htmldom + arguments + builtin + properties + keywords
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
594
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
595 for m in values
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
596 if m =~? '^'.a:base
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
597 call add(res, m)
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
598 elseif m =~? a:base
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
599 call add(res2, m)
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
600 endif
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
601 endfor
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
602
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
603 let menu = res + res2
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
604 let final_menu = []
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
605 for i in range(len(menu))
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
606 let item = menu[i]
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
607 if item =~ '($'
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
608 let kind = 'f'
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
609 if has_key(b:js_menuinfo, item)
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
610 let m_info = b:js_menuinfo[item]
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
611 else
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
612 let m_info = ''
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
613 endif
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
614 else
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
615 let kind = 'v'
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
616 let m_info = ''
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
617 endif
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
618 let final_menu += [{'word':item, 'menu':m_info, 'kind':kind}]
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
619 endfor
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
620 let g:fm = final_menu
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
621 return final_menu
9090f866cd57 updated for version 7.0197
vimboss
parents: 659
diff changeset
622
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
623 endfunction
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
624
d6a69271cb9a updated for version 7.0194
vimboss
parents: 651
diff changeset
625 " vim:set foldmethod=marker: