forked from dcloudio/mui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmui.active.js
30 lines (30 loc) · 853 Bytes
/
mui.active.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* TODO mui active
*/
(function(window) {
var active;
window.addEventListener($.EVENT_START, function(event) {
var target = event.target;
var isCellDisabled = false;
for (; target && target !== document; target = target.parentNode) {
if (target.classList) {
var classList = target.classList;
if (classList.contains(CLASS_DISABLED)) { //normal
isCellDisabled = true;
} else if (target.tagName === 'INPUT' || target.tagName === 'BUTTON' || classList.contains(CLASS_TOGGLE) || classList.contains(CLASS_BTN)) {
isCellDisabled = true;
}
if (classList.contains(CLASS_TABLE_VIEW_CELL)) {
if (!isCellDisabled) {
active = target;
var link = cell.querySelector('a');
if (link && link.parentNode === cell) { //li>a
active = link;
}
}
break;
}
}
}
});
})(window);