add polyfills for .matches and .closest
This commit is contained in:
+5
-1
@@ -1,4 +1,8 @@
|
||||
import 'babel-polyfill'; // TODO: remove it
|
||||
import 'mimic'; // TODO: it's for dev only
|
||||
|
||||
import './polyfills'; // TODO: check it
|
||||
|
||||
import fetcher from './fetcher';
|
||||
import render from './render';
|
||||
|
||||
@@ -7,5 +11,5 @@ require('./main.scss');
|
||||
// TODO: add preloader
|
||||
// TODO: all of these settings must be optional params
|
||||
fetcher
|
||||
.get('/find?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=tree')
|
||||
.get('/find?url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=tree')
|
||||
.then(render);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
if (!Element.prototype.matches)
|
||||
Element.prototype.matches = Element.prototype.msMatchesSelector ||
|
||||
Element.prototype.webkitMatchesSelector;
|
||||
|
||||
if (!Element.prototype.closest)
|
||||
Element.prototype.closest = function(s) {
|
||||
var el = this;
|
||||
if (!document.documentElement.contains(el)) return null;
|
||||
do {
|
||||
if (el.matches(s)) return el;
|
||||
el = el.parentElement || el.parentNode;
|
||||
} while (el !== null);
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user