// Helpers for HTML document element:
class HElement {
    static ById(id) {
        return HById.ElementOf(id);
    }
    static GetById(id) {
        return document.getElementById(id);
    }
    static ScriptCurrent() {
        let scriptTags = document.getElementsByTagName('script');
        if (scriptTags.length == 0)
            throw 'ScriptCurrentElement function must be called from <script> tag.';
        let element = scriptTags[scriptTags.length - 1].parentElement;
        if (!element)
            throw 'Unknown element of <script> tag (ScriptCurrentElement function)';
        return element;
    }
    static ScriptCurrent_Get() {
        let scriptTags = document.getElementsByTagName('script');
        return scriptTags.length > 0 ?
            scriptTags[scriptTags.length - 1].parentElement :
            null;
    }
    static UseClass(element, className, use) {
        if (use)
            HElement.IncludeClass(element, className);
        else
            HElement.ExcludeClass(element, className);
    }
    static IncludeClass(element, className) {
        var classList = element.classList;
        if (!classList.contains(className)) {
            classList.add(className);
            return true;
        }
        return false;
    }
    static ExcludeClass(element, className) {
        var classList = element.classList;
        if (classList.contains(className)) {
            classList.remove(className);
            return true;
        }
        return false;
    }
    static Focus(element) {
        element.focus();
    }
    static Click(element) {
        element.click();
    }
} // HElement
//# sourceMappingURL=HElement.js.map