12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- jvm.AbstractElement = function(name, config){
-
- this.node = this.createElement(name);
-
- this.name = name;
-
- this.properties = {};
- if (config) {
- this.set(config);
- }
- };
- jvm.AbstractElement.prototype.set = function(property, value){
- var key;
- if (typeof property === 'object') {
- for (key in property) {
- this.properties[key] = property[key];
- this.applyAttr(key, property[key]);
- }
- } else {
- this.properties[property] = value;
- this.applyAttr(property, value);
- }
- };
- jvm.AbstractElement.prototype.get = function(property){
- return this.properties[property];
- };
- jvm.AbstractElement.prototype.applyAttr = function(property, value){
- this.node.setAttribute(property, value);
- };
- jvm.AbstractElement.prototype.remove = function(){
- jvm.$(this.node).remove();
- };
|