CoreFiles by mySites.guru
wp-polyfill-node-contains.js34 lines, 643 bytes, from wordpress-5.9.21.zip
Raw History Compare with 5.9.20
md5
2f32953b9db0b8f18328faeb5582b5a0
sha1
81cc2ecf33b46d22b3d331854ea120d230a37817
sha256
b8abf30b51c569f9a95db8b9f449698543c9ef22d6fcfda25f507587a35d12ee

// Node.prototype.contains
(function() {

	function contains(node) {
		if (!(0 in arguments)) {
			throw new TypeError('1 argument is required');
		}

		do {
			if (this === node) {
				return true;
			}
		// eslint-disable-next-line no-cond-assign
		} while (node = node && node.parentNode);

		return false;
	}

	// IE
	if ('HTMLElement' in self && 'contains' in HTMLElement.prototype) {
		try {
			delete HTMLElement.prototype.contains;
		// eslint-disable-next-line no-empty
		} catch (e) {}
	}

	if ('Node' in self) {
		Node.prototype.contains = contains;
	} else {
		document.contains = Element.prototype.contains = contains;
	}

}());

The same content is in 362 releases, WordPress 5.8-beta1 to 7.2-RC2. See them all, or every version of this file.