Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/sender/toloka/src/autocomplete/components/ |
Upload File : |
const allowedAttributes = { value: "data-value", name: "data-name", disabled: "data-disabled", class: "class", type: "type" }; class Element { constructor(element, attributes = {}, i18n = {}) { this._node = element instanceof HTMLElement ? element : document.createElement(element); this._config = { i18n }; this._setAttributes(attributes); if (attributes.textContent) { this._setTextContent(attributes.textContent); } return this; } get() { return this._node; } append(element) { this._node.appendChild(element); return this; } addClass(className) { this._node.classList.add(className); return this; } removeClass(className) { this._node.classList.remove(className); return this; } toggleClass(className) { this._node.classList.toggle(className); return this; } addEventListener(type, callback) { this._node.addEventListener(type, callback); return this; } removeEventListener(type, callback) { this._node.removeEventListener(type, callback); return this; } setText(text) { this._setTextContent(text); return this; } getHeight() { return window.getComputedStyle(this._node).height; } getWidth() { return window.getComputedStyle(this._node).width; } setTop(top) { this._node.style.top = `${top}px`; return this; } focus() { this._node.focus(); return this; } _setTextContent(textContent) { this._node.textContent = textContent; } _setAttributes(attributes) { for (const key in attributes) { if (allowedAttributes[key] && attributes[key]) { this._setAttribute(allowedAttributes[key], attributes[key]); } } } _setAttribute(key, value) { this._node.setAttribute(key, value); } _getAttribute(key) { this._node.getAttribute(key); } } export default Element;