/**
 * Specialized layer for error markers.
 * @author Louis-Dominique Dubeau
 * @license MPL 2.0
 * @copyright Mangalam Research Center for Buddhist Languages
 */
define(["require", "exports", "./layer"], function (require, exports, layer_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    /**
     * Specialized layer for error markers.
     */
    class ErrorLayer extends layer_1.Layer {
        constructor(el) {
            super(el);
            this.el = el;
        }
        select(marker) {
            if (marker.parentNode !== this.el) {
                throw new Error("marker is not a child of the layer element");
            }
            this.unselectAll();
            marker.classList.add("selected");
        }
        unselectAll() {
            let child = this.el.firstElementChild;
            while (child !== null) {
                child.classList.remove("selected");
                child = child.nextElementSibling;
            }
        }
    }
    exports.ErrorLayer = ErrorLayer;
});
//  LocalWords:  MPL
//# sourceMappingURL=error-layer.js.map