Exported MS Edge polyfill
This commit is contained in:
parent
fc798b9e12
commit
4f5bab8237
|
@ -4,8 +4,9 @@ import Highlighter from './highlighter/Highlighter';
|
||||||
import SelectionHandler from './selection/SelectionHandler';
|
import SelectionHandler from './selection/SelectionHandler';
|
||||||
import RelationsLayer from './relations/RelationsLayer';
|
import RelationsLayer from './relations/RelationsLayer';
|
||||||
import RelationEditor from './relations/editor/RelationEditor';
|
import RelationEditor from './relations/editor/RelationEditor';
|
||||||
|
import { addPolyfills } from './utils/MSEdgePolyfills';
|
||||||
|
|
||||||
import './utils/MSEdgePolyfills';
|
addPolyfills(); // For Microsoft Edge
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pulls the strings between the annotation highlight layer
|
* Pulls the strings between the annotation highlight layer
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
if (!Element.prototype.matches) {
|
export const addPolyfills = () => {
|
||||||
Element.prototype.matches = Element.prototype.msMatchesSelector ||
|
|
||||||
Element.prototype.webkitMatchesSelector;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Element.prototype.closest) {
|
if (!Element.prototype.matches) {
|
||||||
Element.prototype.closest = function(s) {
|
Element.prototype.matches = Element.prototype.msMatchesSelector ||
|
||||||
let el = this;
|
Element.prototype.webkitMatchesSelector;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Element.prototype.closest) {
|
||||||
|
Element.prototype.closest = function(s) {
|
||||||
|
let el = this;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (Element.prototype.matches.call(el, s)) return el;
|
||||||
|
el = el.parentElement || el.parentNode;
|
||||||
|
} while (el !== null && el.nodeType === 1);
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
|
||||||
if (Element.prototype.matches.call(el, s)) return el;
|
|
||||||
el = el.parentElement || el.parentNode;
|
|
||||||
} while (el !== null && el.nodeType === 1);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue