efront 3.12.6 → 3.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,3 +10,4 @@
10
10
  invoke: options ::invoke-:key?:params
11
11
  version: options ::version
12
12
  uptime: options ::uptime
13
+ count: options ::count
@@ -25,4 +25,4 @@
25
25
  <padding>
26
26
  启动时间&nbsp;&nbsp;<span -text="filterTime(hrtime)"></span>
27
27
  </padding>
28
- </block>
28
+ </block>
@@ -6,15 +6,12 @@ function main() {
6
6
  version: data.from("version"),
7
7
  hrtime: data.from("uptime", a => Date.now() - a * 1000),
8
8
  filterTime,
9
- async run(id, target) {
10
- target.setAttribute('pending', '')
11
- try {
12
- var info = await data.from("run", {
13
- run: id
14
- }).loading_promise;
15
- if (info) alert(info, 'pass');
16
- } catch { }
17
- target.removeAttribute('pending');
9
+ async run(id) {
10
+ await new Promise(ok => setTimeout(ok, 2000));
11
+ var info = await data.from("run", {
12
+ run: id
13
+ }).loading_promise;
14
+ if (info) alert(info, 'pass');
18
15
  },
19
16
  async logout() {
20
17
  data.setSource({});
@@ -0,0 +1 @@
1
+ <table -src="[fields,items]"></talbe>
@@ -0,0 +1,15 @@
1
+ var fields = refilm`
2
+ 路径/path
3
+ 访问量/count
4
+ `;
5
+ function main() {
6
+ var page = div();
7
+ page.innerHTML = template;
8
+ renderWithDefaults(page, {
9
+ items: data.from("count", a => {
10
+ return Object.keys(a).map(b => ({ path: b, count: a[b] }));
11
+ }),
12
+ fields
13
+ });
14
+ return page;
15
+ }
@@ -0,0 +1,8 @@
1
+ & {
2
+ height: 100%;
3
+
4
+ }
5
+
6
+
7
+ tbody {
8
+ }
@@ -8,4 +8,6 @@ WEB:
8
8
  密钥管理: /token/list
9
9
  任务建立: /task/list
10
10
  定期执行: /tick/list
11
- # 用户列表: /user/list
11
+ # 用户列表: /user/list
12
+ 服务器日志:
13
+ 访问计数: /log/count
@@ -1,7 +1,3 @@
1
- >table {
2
- width: 100%;
3
- }
4
-
5
1
  & {
6
2
  height: 100%;
7
3
  }
@@ -207,7 +207,7 @@ var scan = function (text) {
207
207
  }
208
208
  }
209
209
 
210
- if (row === "|") {
210
+ if (row === "|" || row === ">") {
211
211
  rowtype = "|"
212
212
  continue;
213
213
  }
@@ -195,6 +195,7 @@
195
195
  result.then = then;
196
196
  return result;
197
197
  };
198
+ result.parse = parseMenuList;
198
199
  var then = function (ok, oh) {
199
200
  if (this.loading_promise) {
200
201
  return this.loading_promise.then(ok, oh);
@@ -1,5 +1,5 @@
1
1
  <div ng-class="{even:i%2===1,odd:i%2===0}" v-for="(r,i) in rates" hz:='r[5]'>
2
- <span ng-if="i%2===0" v-bind="i/2 -2"></span>
2
+ <span ng-if="i%2===0" v-bind="i/2 -8"></span>
3
3
  <button ng-repeat="o in r" _rate=o>
4
4
  <span ng-bind="format(o)"></span>
5
5
  </button>
@@ -2,8 +2,8 @@ function piano() {
2
2
  var res = [];
3
3
  var yin = [1, 3, 5, 7, 8, 10, 12].reverse();
4
4
  var yue = [2, 4, 6, 9, 11].reverse();
5
- var c=a => 440 * Math.pow(2, cx + (3 - a) / 12);
6
- for (var cx = -6, dx = 8; cx < dx; cx++) {
5
+ var c = a => 440 * Math.pow(2, cx + (3 - a) / 12);
6
+ for (var cx = -12, dx = 8; cx < dx; cx++) {
7
7
  var yinjie1 = yin.map(c);
8
8
  var yinjie2 = yue.map(c);
9
9
  res.push(yinjie1, yinjie2);
@@ -23,7 +23,7 @@ function main() {
23
23
  oscillator.connect(gainNode);
24
24
  gainNode.connect(audioCtx.destination);
25
25
  oscillator.type = 'sine';
26
- oscillator.frequency.value = hz;
26
+ oscillator.frequency.value = -hz;
27
27
  gainNode.gain.setValueAtTime(0, audioCtx.currentTime);
28
28
  gainNode.gain.linearRampToValueAtTime(65536 / Math.log2(hz), audioCtx.currentTime + 0.01);
29
29
  oscillator.start(audioCtx.currentTime);
@@ -1,10 +1,12 @@
1
1
  function bind(eventName, bindTo = window) {
2
2
  return function (target, eventListener) {
3
3
  var off;
4
- var off1 = on("append")(target, function () {
4
+ var mount = function () {
5
5
  if (off) off();
6
6
  off = on(eventName).call(bindTo, target, eventListener);
7
- });
7
+ };
8
+ if (isMounted(target)) mount();
9
+ var off1 = on("append")(target, mount);
8
10
  var off2 = on("remove")(target, function () {
9
11
  if (off) off();
10
12
  off = null;
@@ -1,5 +1,5 @@
1
1
  var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace".split(",");
2
- var cloneProperties2 = "position,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
2
+ var cloneProperties2 = "position,backdropFilter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
3
3
  var pushProperty = function (key, props) {
4
4
  props.split(",").forEach(k => {
5
5
  cloneProperties2.push(key + k);
@@ -86,7 +86,13 @@ var isMaybeVisible = function (node) {
86
86
  if (style.overflow === "hidden") {
87
87
  if (node.offsetHeight === 0 || node.offsetWidth === 0) return;
88
88
  }
89
- if (node.offsetParent && !overlap(node, node.offsetParent)) return;
89
+ if (node.offsetParent) {
90
+ var parent = node.offsetParent;
91
+ return !(node.offsetLeft + node.offsetWidth - parent.scrollLeft <= parent.clientLeft ||
92
+ node.offsetTop + node.offsetHeight - parent.scrollTop <= parent.clientTop ||
93
+ node.offsetLeft - parent.scrollLeft >= (parent.clientWidth || parent.offsetWidth) ||
94
+ node.offsetTop - parent.scrollTop >= (parent.clientHeight || parent.offsetHeight));
95
+ }
90
96
  return true;
91
97
  }
92
98
  var clonePseudo = function (node, pseudo) {
@@ -173,6 +179,7 @@ var cloneVisible = function (td) {
173
179
  };
174
180
  clone(td);
175
181
  extend(result.style, {
182
+ zIndex: getComputedStyle(td).zIndex,
176
183
  position: "absolute",
177
184
  left: _left + "px",
178
185
  top: _top + "px",
@@ -61,8 +61,9 @@ function drag(target, initialEvent, preventOverflow, isMovingSource) {
61
61
  saved_delta.x += clone_left - target_left;
62
62
  saved_delta.y += clone_top - target_top;
63
63
  if (clone.style) {
64
- clone.style.zIndex = zIndex();
65
- extraClones.map(e => e.style.zIndex = clone.style.zIndex);
64
+ var z = zIndex();
65
+ clone.style.zIndex = z + (+clone.style.zIndex || 0);
66
+ extraClones.map(e => e.style.zIndex = z + (+e.style.zIndex || 0));
66
67
  }
67
68
  }
68
69
  drag.target = clone;
@@ -101,23 +101,34 @@ function main(elem, mode) {
101
101
  // }
102
102
  // elem.setAttribute('browser', os);
103
103
  var mode = elem.getAttribute('mode') || elem.getAttribute('type');
104
+ if (!mode) {
105
+ if (elem.hasAttribute("inline")) mode = 'inline';
106
+ else if (elem.hasAttribute("vertical")) mode = "vertical";
107
+ else if (elem.hasAttribute("horizonal")) mode = "horizonal";
108
+ else if (
109
+ elem.hasAttribute("toolbar")
110
+ || elem.hasAttribute('tool')
111
+ || elem.hasAttribute('tools')
112
+ || elem.hasAttribute('bar')
113
+ ) mode = "toolbar";
114
+ }
104
115
  if (!mode) {
105
116
  if (/^[xyhvtci]/i.test(elem.tagName)) {
106
117
  mode = elem.tagName.slice(0, 1);
118
+ if (/^t$/i.test(mode)) mode = elem.tagName.slice(0, 2);
107
119
  }
108
- else if (/[xyhvtci]$/i.test(elem.tagName)) {
109
- mode = elem.tagName.slice(0, 1);
120
+ else if (/[xyhvci]$/i.test(elem.tagName)) {
121
+ mode = elem.tagName.slice(elem.tagName.length - 1);
110
122
  }
111
123
  }
112
124
  mode = mode ? mode.toLowerCase() : "horizonal";
113
-
125
+ var direction;
114
126
  switch (mode) {
127
+ case "tr":
115
128
  case "i":
116
129
  case "c":
117
130
  case "inline":
118
- case "t":
119
- case "tree":
120
- mode = "tree";
131
+ mode = "inline";
121
132
  if (elem) {
122
133
  var generator = getGenerator(elem, 'menu-item');
123
134
  tree(elem, function (index, item) {
@@ -145,22 +156,31 @@ function main(elem, mode) {
145
156
  elem = inlineMenu.call(elem, nodes);
146
157
  }
147
158
  break;
159
+ case "to":
160
+ case "t":
161
+ case "b":
162
+ case "tool":
163
+ case "tools":
164
+ case "bar":
165
+ case "toolbar":
166
+ direction = 't';
167
+ mode = "toolbar";
148
168
  case "h":
149
169
  case "x":
150
170
  case "horizonal":
151
- var direction = 'x';
152
- mode = "horizonal";
171
+ if (!direction) {
172
+ direction = 'x';
173
+ mode = "horizonal";
174
+ }
153
175
  case "v":
154
176
  case "y":
155
177
  case "vertical":
178
+ if (!direction) mode = "vertical", direction = 'y';
156
179
  var emit = function (item, target) {
157
180
  active(elem, item.value, item, target);
158
181
  };
159
182
  if ("$src" in elem) {
160
183
  getGenerator(elem, 'menu-item');
161
- on("append")(elem, function () {
162
- elem.registerAsRoot();
163
- });
164
184
  var src0 = [];
165
185
  menuList(elem, src0, emit, direction);
166
186
  care(elem, function (src) {
@@ -177,7 +197,6 @@ function main(elem, mode) {
177
197
  var nodes = getArrayNodes(elem);
178
198
  remove(elem.children);
179
199
  elem = menuList(elem, nodes, emit, direction);
180
- elem.registerAsRoot();
181
200
  }
182
201
  break;
183
202
  default:
@@ -187,7 +206,8 @@ function main(elem, mode) {
187
206
  mode = mode || "horizonal";
188
207
  elem = menu.apply(null, arguments);
189
208
  }
190
- elem.setAttribute('mode', mode);
209
+ if (!elem.hasAttribute('mode')) elem.setAttribute('mode', mode);
210
+ if (!elem.hasAttribute(mode)) elem.setAttribute(mode, '');
191
211
  return elem;
192
212
 
193
213
  }
@@ -82,13 +82,11 @@ body:active & {
82
82
  width: 100%;
83
83
  }
84
84
 
85
- &[mode=vertical],
86
- &[type=vertical] {
85
+ &[vertical] {
87
86
  display: block;
88
87
  }
89
88
 
90
- &[mode=horizonal],
91
- &[type=horizonal] {
89
+ &[horizonal] {
92
90
  display: block;
93
91
  overflow: hidden;
94
92
  text-overflow: hidden;
@@ -115,11 +113,35 @@ body:active & {
115
113
 
116
114
  }
117
115
 
118
- &[mode=tree],
119
- &[mode=tree],
120
- &[type=tree],
121
- &[mode=inline],
122
- &[type=inline] {
116
+ &[toolbar] {
117
+ >menu-item{
118
+ padding-left: 6px;
119
+ padding-right: 6px;
120
+ text-align: center;
121
+ }
122
+ >menu-item.has-children {
123
+ &::after {
124
+ display: block;
125
+ content: "";
126
+ width: 0;
127
+ height: 0;
128
+ font-size: 0;
129
+ transform: none;
130
+ border: 2px solid;
131
+ border-top-color: transparent;
132
+ border-left-color: transparent;
133
+ position: absolute;
134
+ right: 3px;
135
+ bottom: 3px;
136
+ box-sizing: border-box;
137
+ line-height: 0;
138
+ top: auto;
139
+ margin: 0;
140
+ }
141
+ }
142
+ }
143
+
144
+ &[inline] {
123
145
  height: auto;
124
146
  box-shadow: none;
125
147
  padding: 0;
@@ -11,7 +11,7 @@ function main(elem, scope, hasIcon) {
11
11
  var name = scope.name;
12
12
  var icon = scope.icon;
13
13
  if (hasIcon === undefined) hasIcon = !!icon;
14
- render(item.children, { useIcon: hasIcon, hasIcon, name, icon });
14
+ render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon, name, icon }]);
15
15
  if (scope.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
16
16
  return item;
17
17
  }
@@ -1,4 +1,6 @@
1
- <menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)"
2
- ng-mouseleave="cancel()" ng-mouseenter="popMenu.call(this)"
3
- ng-class="{'has-children':menu.children&&menu.children.length,'warn':menu.type==='danger'||menu.type==='warn'||menu.type==='red'}">
1
+ <menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)" ng-mouseleave="cancel()"
2
+ ng-mouseenter="popMenu.call(this)" ng-mousedown="popMenu1.call(this,event)" ng-class="{'has-children':menu.children&&menu.children.length,
3
+ 'warn':menu.type==='danger'||menu.type==='warn'||menu.type==='red',
4
+ 'selected':menu.selected
5
+ }">
4
6
  </menu-item>
@@ -102,23 +102,23 @@ var keyAction = function (deltax, deltay) {
102
102
  }
103
103
  };
104
104
  function keyalt() {
105
- if (root_menu === document.activeElement) root_menu.blur();
106
- else {
105
+ if (this === document.activeElement) this.blur();
106
+ else if (root_menu === this && root_menu !== document.activeElement) {
107
107
  root_menu.tabIndex = 0;
108
108
  root_menu.focus();
109
- root_menu.setFocus(this.firstMenu);
109
+ root_menu.setFocus(root_menu.firstMenu);
110
110
  }
111
111
  }
112
112
  function keytab(event) {
113
- if (root_menu !== document.activeElement) return;
114
113
  var menu = mounted_menus[mounted_menus.length - 1] || root_menu;
115
114
  event.preventDefault();
116
115
  menu.moveFocus(event.shiftKey ? -1 : 1);
117
116
  }
118
117
  function keyesc() {
119
- if (root_menu === document.activeElement && !mounted_menus.length) {
120
- if (!root_menu.ispop) root_menu.blur();
121
- else root_menu.ispop = false;
118
+ if (this !== document.activeElement) return;
119
+ if (!mounted_menus.length) {
120
+ if (!this.ispop) this.blur();
121
+ else this.ispop = false;
122
122
  }
123
123
  }
124
124
  function keyup() {
@@ -134,7 +134,6 @@ function keyright() {
134
134
  keyAction(1, 0);
135
135
  }
136
136
  function keyspace() {
137
- if (root_menu !== document.activeElement) return;
138
137
  var menu = mounted_menus[mounted_menus.length - 1];
139
138
  if (!menu || !menu.focused) menu = mounted_menus[mounted_menus.length - 2] || root_menu;
140
139
  if (menu.focused) {
@@ -142,23 +141,26 @@ function keyspace() {
142
141
  }
143
142
  }
144
143
  function register() {
145
- root_menu = this;
146
- bind('keydown.tab')(root_menu, keytab);
147
- bind('keydown.alt.')(root_menu, keyalt);
148
- bind('keydown.esc')(root_menu, keyesc);
149
- bind('keydown.left')(root_menu, keyleft);
150
- bind('keydown.right')(root_menu, keyright);
151
- bind('keydown.up')(root_menu, keyup);
152
- bind('keydown.down')(root_menu, keydown);
153
- bind('keydown.enter')(root_menu, keyspace);
154
- bind('keydown.space')(root_menu, keyspace);
144
+ var menu = this;
145
+ // if (!root_menu) root_menu = this;
146
+ bind('keydown.alt.')(menu, keyalt);
147
+ bind('keydown.esc')(menu, keyesc);
148
+ on('keydown.tab')(menu, keytab);
149
+ on('keydown.left')(menu, keyleft);
150
+ on('keydown.right')(menu, keyright);
151
+ on('keydown.up')(menu, keyup);
152
+ on('keydown.down')(menu, keydown);
153
+ on('keydown.enter')(menu, keyspace);
154
+ on('keydown.space')(menu, keyspace);
155
+ on("contextmenu")(menu, e => e.preventDefault());
155
156
  }
156
157
  function main(page, items, active, direction = 'y') {
157
158
  if (!isNode(page)) {
158
159
  var page = div();
159
160
  }
160
161
  var main = this;
161
- if (direction !== 'x') page.ispop = true;
162
+ if (direction == 'y') page.ispop = true;
163
+ var istoolbar = direction === 't';
162
164
  function popMenu(item, target) {
163
165
  if (page.actived) {
164
166
  clear();
@@ -195,7 +197,7 @@ function main(page, items, active, direction = 'y') {
195
197
  if (offenter1) offenter1();
196
198
  });
197
199
  }
198
- if (!page.ispop) on("blur")(page, unfocus);
200
+ on("blur")(page, unfocus);
199
201
  var template = page.tempalte || document.createElement("ylist");
200
202
  if (!page.tempalte) {
201
203
  template.className = '';
@@ -203,14 +205,19 @@ function main(page, items, active, direction = 'y') {
203
205
  template.innerHTML = page.innerHTML;
204
206
  page.tempalte = template;
205
207
  }
206
- var popTimer = 0;
207
- var open = function () {
208
+ var popTimer = 0, byMousedown;
209
+ var open = function (time) {
208
210
  cancel();
209
211
  var elem = this;
210
- if (page.ispop) popTimer = setTimeout(function () {
212
+ time = +time;
213
+ if (byMousedown && !time) return;
214
+ if (time) byMousedown = false;
215
+
216
+ if (page.ispop || time) popTimer = setTimeout(function () {
217
+ if (time) byMousedown = elem;
211
218
  page.setFocus(elem);
212
219
  popMenu(elem.menu, elem);
213
- }, 60);
220
+ }, time || 60);
214
221
  };
215
222
  var cancel = function () {
216
223
  clearTimeout(popTimer);
@@ -218,13 +225,29 @@ function main(page, items, active, direction = 'y') {
218
225
  var fire = function () {
219
226
  cancel();
220
227
  if (this.menu.line) return;
228
+ if (byMousedown) return;
221
229
  var pop = active(this.menu, this);
222
230
  if (pop === false) return;
223
231
  var root = page.root || page;
232
+ if (root.direction === 't') {
233
+ var menu = this.menu;
234
+ if (root !== page) {
235
+ delete menu.children;
236
+ var target = root.actived.target;
237
+ menu = extend(target.menu, menu);
238
+ }
239
+ else {
240
+ target = this;
241
+ }
242
+ if (root.selected) root.selected.selected = false;
243
+ menu.selected = true;
244
+ root.selected = target.menu;
245
+ }
224
246
  if (root.ispop === 1) root.ispop = false;
225
247
  if (page.actived && page.actived.target === this) {
226
248
  while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page.actived) remove(mounted_menus.pop());
227
249
  if (!mounted_menus.length) {
250
+ if (byMousedown === false) return;
228
251
  popMenu(this.menu, this);
229
252
  }
230
253
  else {
@@ -233,14 +256,17 @@ function main(page, items, active, direction = 'y') {
233
256
  }
234
257
  else {
235
258
  while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page) remove(mounted_menus.pop());
259
+ if (byMousedown === false) return;
236
260
  popMenu(this.menu, this);
237
261
  if (!page.actived) {
238
262
  (page.root || page).blur();
239
263
  }
240
264
  }
241
265
  };
242
-
243
-
266
+ var open1 = function (event) {
267
+ if (event.which === 3) event.preventDefault();
268
+ if (istoolbar) open.call(this, event.button ? 20 : 600);
269
+ };
244
270
  if (!page.children.length || page.menutype === 1) {
245
271
  page.menutype = 1;
246
272
  var hasIcon = function () {
@@ -268,11 +294,15 @@ function main(page, items, active, direction = 'y') {
268
294
  open: fire,
269
295
  cancel,
270
296
  popMenu: open,
297
+ popMenu1: open1
271
298
  };
272
299
  if (page.$src) {
273
300
  var src = page.$src;
274
301
  var itemName = src.itemName;
275
- var className = `{'has-children':${itemName}.children&&${itemName}.children.length,'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red'}`;
302
+ var className = `{'has-children':${itemName}.children&&${itemName}.children.length,
303
+ 'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red',
304
+ 'selected':${itemName}.selected
305
+ }`;
276
306
  var notHidden = `!${itemName}.hidden`;
277
307
  var generator = getGenerator(page, 'menu-item');
278
308
  list(page, function (index) {
@@ -286,6 +316,7 @@ function main(page, items, active, direction = 'y') {
286
316
  a.menu = item;
287
317
  on("mouseleave")(a, cancel);
288
318
  on("mouseenter")(a, open);
319
+ if (istoolbar) on("mousedown")(a, open1);
289
320
  on("click")(a, fire);
290
321
  return a;
291
322
  });
@@ -316,6 +347,7 @@ function main(page, items, active, direction = 'y') {
316
347
  elem.menu = this.src[index];
317
348
  on("mouseleave")(elem, cancel);
318
349
  on("mouseenter")(elem, open);
350
+ if (istoolbar) on("mousedown")(elem, open1);
319
351
  on("click")(elem, fire);
320
352
  return elem;
321
353
  }, direction);
@@ -326,11 +358,14 @@ function main(page, items, active, direction = 'y') {
326
358
  page.active = function (a) {
327
359
  fire.call(a);
328
360
  };
329
- page.registerAsRoot = register;
330
361
  page.setFocus = setFocus;
331
362
  page.moveFocus = moveFocus;
332
363
  page.openFocus = openFocus;
333
364
  page.closeFocus = closeFocus;
334
365
  page.direction = direction;
366
+ register.call(page);
367
+ page.registerAsRoot = function () {
368
+ root_menu = this;
369
+ };
335
370
  return page;
336
371
  }
@@ -29,6 +29,11 @@
29
29
  color: #29c;
30
30
  }
31
31
 
32
+ &.selected {
33
+ background: #29c;
34
+ color: #fff;
35
+ }
36
+
32
37
  &.has-children {
33
38
  padding-right: 24px;
34
39
  padding-left: 16px;
package/coms/zimoli/on.js CHANGED
@@ -155,14 +155,16 @@ function checkKeyNeed(eventtypes, e) {
155
155
  }
156
156
  return true;
157
157
  }
158
+ var pendingid = 0;
158
159
  function wrapHandler(h) {
159
160
  if (h instanceof Function) {
160
161
  return function () {
161
162
  var res = h.apply(this, arguments);
162
163
  if (res && isFunction(res.then)) {
163
- this.setAttribute('pending', '');
164
+ var id = ++pendingid & 0x1fffffffffffff;
165
+ this.setAttribute('pending', id);
164
166
  var removePending = () => {
165
- this.removeAttribute('pending');
167
+ if (+this.getAttribute('pending') === id) this.removeAttribute('pending');
166
168
  };
167
169
  res.then(removePending, removePending);
168
170
  }
@@ -273,7 +275,7 @@ if (is_addEventListener_enabled) {
273
275
  }
274
276
  if (e.button) {
275
277
  if (e.buttons === undefined) e.buttons = e.button;
276
- if (e.which === undefined) e.which = e.button;
278
+ if (e.which === undefined) e.which = e.button + 1;
277
279
  }
278
280
  if (e.keyCode) {
279
281
  if (e.which === undefined) e.which = e.keyCode;