mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-24 14:57:26 +08:00
13 lines
354 B
JavaScript
13 lines
354 B
JavaScript
|
|
(()=>{
|
|
Element.prototype.closestWithin = function(selector, parent) {
|
|
const el = this.closest(selector);
|
|
return (el && el !== parent && parent.contains(el)) ? el : null;
|
|
};
|
|
|
|
Element.fromHTML = string => {
|
|
const template = document.createElement('template');
|
|
template.innerHTML = string.trim();
|
|
return template.content.firstChild;
|
|
};
|
|
})();
|