/** @constructor */
var Element = function(element) {
this[0] = element;
element.$elt = this;
element.addEventListener('dispose', function() {
setTimeout(function() { //allow other dispose event listeners
this[0].$elt = undefined; // ie does not allow deletion of properties on elements.
delete this[0].$elt;
Object.keys(this).forEach(function(key) {
delete this[key];
}.bind(this));
}.bind(this), 1);
}.bind(this), false);
};
module.exports = Element;
var elements = require('./elements');
Element.prototype = {
/**
* Get the value of an attribute
* @param {string} attributeName
* @return {string}
*/
getAttribute: function(attributeName) {
return elements.getAttribute(this[0], attributeName);
},
/**
* Get value
* @return {string}
*/
getValue: function() {
return elements.getValue(this[0]);
},
/**
* Set value
* @param {string} _class
* @return {Element}
*/
setValue: function(value) {
elements.setValue(this[0], value);
return this;
}
};
class ElementBasic extends Element {
constructor(tagName) {
Element.call(this, document.createElement(tagName));
}
}
/**
* @constructor
* @augments {Element}
* @param {string} tagName
*/
Element.Basic = ElementBasic;
/**
* @constructor
* @augments {Element}
* @param {string} tagName
*/
Element.WithContent = Element.Basic;