mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-11 20:44:55 +00:00
fd094eea95
* fix commit view JS features, reimplement folding File content folding was not working so I reimplemented it in a saner way. Then I noticed the issue was actually because of missing JS libraries (seen on the console of every commit with error 'SimpleMDE is not defined'). Fixed the libraries. I think the reimplementation is worth to keep. * add .closest polyfill Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
// compat: IE11
|
|
if (!Element.prototype.matches) {
|
|
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
}
|
|
|
|
// compat: IE11
|
|
if (!Element.prototype.closest) {
|
|
Element.prototype.closest = function (s) {
|
|
let el = this;
|
|
|
|
do {
|
|
if (el.matches(s)) return el;
|
|
el = el.parentElement || el.parentNode;
|
|
} while (el !== null && el.nodeType === 1);
|
|
return null;
|
|
};
|
|
}
|