forked from u1ui/js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.js
36 lines (24 loc) · 775 Bytes
/
init.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
31
32
33
34
35
36
/* prevent double-click selection */
addEventListener('mousedown', e => {
if (e.detail < 2) return; // // check event.ctrlKey/event.shiftKey/event.altKey?
let target = e.composedPath()[0]; // shadow dom
if (!target.closest('summary,label')) return;
e.preventDefault();
});
/*
Copy styles to the shadow-dom
- add functionality to a custom Element Class we can inherit?
onElement('[deep-css]',el=>{
for (let ss of document.styleSheets) el.shadowRoot.append(ss.ownerNode.cloneNode());
})
*/
/*
Add classes on running transitions
- does this take up too much performance?
addEventListener('transitionstart',e=>{
e.target.classList.add('u1-animating')
})
addEventListener('transitionend',e=>{
e.target.classList.remove('u1-animating')
})
*/