"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Renderables_1 = require("../Renderables");
/**
 * Implementation of the 'image' markup element.
 * An img HTML element is created and the given
 * attributes src, alt, with and height are taken over.
 * The class lto-image is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 */
var Image = /** @class */ (function () {
    function Image(spec) {
        this.spec = spec;
    }
    /**
     * @inheritDoc
     */
    Image.prototype.render = function (renderer, isNested) {
        var image = document.createElement('img');
        image.setAttribute('src', this.spec.src || "");
        image.setAttribute('alt', this.spec.text || "");
        image.setAttribute('width', this.spec.width || "auto");
        image.setAttribute('height', this.spec.height || "auto");
        image.classList.add('lto-image', "lto-" + (this.spec.position || 'left'));
        if (this.spec.id !== undefined) {
            image.id = this.spec.id;
        }
        if (this.spec.class !== undefined) {
            this.spec.class.split(" ").forEach(function (e) { return image.classList.add(e); });
        }
        return image;
    };
    return Image;
}());
exports.Image = Image;
Renderables_1.default.register("image", Image);
//# sourceMappingURL=index.js.map