document.contains
Version:
Polyfill/shim for `document.contains`
24 lines (21 loc) • 559 B
JavaScript
;
var define = require('define-properties');
var getPolyfill = require('./polyfill');
module.exports = function shimContains() {
var polyfill = getPolyfill();
if (typeof document !== 'undefined') {
define(
document,
{ contains: polyfill },
{ contains: function () { return document.contains !== polyfill; } }
);
if (typeof Element !== 'undefined') {
define(
Element.prototype,
{ contains: polyfill },
{ contains: function () { return Element.prototype.contains !== polyfill; } }
);
}
}
return polyfill;
};