document.querySelector('#id')
document.querySelectorAll('.class > ul li')
document.getElementById('id')
document.getElementsByClassName('class')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.directive('click-outside-component', { | |
bind(el, binding, vnode) { | |
el.clickOutsideEvent = function(event) { | |
if (!(vnode.context.$el == event.target || vnode.context.$el.contains(event.target))) { | |
vnode.context[binding.expression](event) | |
} | |
} | |
document.body.addEventListener('click', el.clickOutsideEvent) | |
}, | |
unbind(el) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.directive('click-outside-element', { | |
bind(el, bind, vn) { | |
el.cO = event => { | |
if (!(el == event.target || el.contains(event.target))) { | |
if(vn.context[bind.expression]) { | |
vn.context[bind.expression](event) | |
} | |
} | |
} | |
document.body.addEventListener('click', el.cO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount() { | |
document.addEventListener('click', this.clickOutside.bind(this), true); | |
} | |
componentWillUnmount() { | |
document.removeEventListener('click', this.clickOutside.bind(this), true); | |
} | |
clickOutside(event) { | |
const domNode = ReactDOM.findDOMNode(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
526017964561, | |
525608647855, | |
526013197030, | |
526017918501, | |
526013196478, | |
526200201544, | |
526200024126, | |
526014627350, | |
526006502928, |
(?<=\+)(.*)(?=\@)
will match world
in [email protected]
- start at
+
with(?<=\+)
- select all characters with
(.*)
- end at
@
with(?-\@)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/ | |
let context = []; | |
export function untrack(fn) { | |
const prevContext = context; | |
context = []; | |
const res = fn(); | |
context = prevContext; | |
return res; |