Added target attribute support. Ignite Object now supports setProperties. Added null check for props. Fixed some documentation wording.
This commit is contained in:
parent
46ff7743a1
commit
31503e62d1
@ -180,7 +180,15 @@ class IgniteElement extends HTMLElement {
|
||||
* Sets all the property values on this element.
|
||||
*/
|
||||
setProperties(props) {
|
||||
if (props) {
|
||||
if (props == null || props == undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (props instanceof IgniteObject) {
|
||||
props.update();
|
||||
|
||||
Object.getOwnPropertyNames(props).forEach(name => this[name] = props[name]);
|
||||
} else {
|
||||
Object.keys(props).forEach(name => this[name] = props[name]);
|
||||
}
|
||||
}
|
||||
|
@ -402,6 +402,23 @@ class IgniteObject {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the values of properties on this ignite object.
|
||||
* @param {Object|IgniteObject} props The properties to set onto this ignite object.
|
||||
*/
|
||||
setProperties(props) {
|
||||
if (props == null || props == undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (props instanceof IgniteObject) {
|
||||
props.update();
|
||||
Object.getOwnPropertyNames(props).forEach(name => this[name] = props[name]);
|
||||
} else {
|
||||
Object.keys(props).forEach(name => this[name] = props[name]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an IgniteObject or Array of IgniteObjects and returns it.
|
||||
* @param {Object|Array} obj The object to create an IgniteObject from.
|
||||
|
@ -841,7 +841,7 @@ class IgniteTemplate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value attribute of the element to be constructed by this template.
|
||||
* Sets the src attribute of the element to be constructed by this template.
|
||||
* @param {String|IgniteProperty} value The value to set for the src attribute of the element to be constructed by this template.
|
||||
* @param {Function} converter An optional function that can convert the value if needed.
|
||||
* @returns This ignite template so function calls can be chained.
|
||||
@ -851,8 +851,8 @@ class IgniteTemplate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value attribute of the element to be constructed by this template.
|
||||
* @param {String|IgniteProeprty} value The value to set for the href attribute of the element to be constructed by this template.
|
||||
* Sets the href attribute of the element to be constructed by this template.
|
||||
* @param {String|IgniteProperty} value The value to set for the href attribute of the element to be constructed by this template.
|
||||
* @param {Function} converter An optional function that can convert the value if needed.
|
||||
* @returns This ignite template so function calls can be chained.
|
||||
*/
|
||||
@ -860,6 +860,16 @@ class IgniteTemplate {
|
||||
return this.attribute("href", value, converter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target attribute of the element to be constructed by this template.
|
||||
* @param {String|IgniteProperty} value The value to set for the target attribute of the element to be constructed by this template.
|
||||
* @param {Function} converter An optional function that can convert the value if needed.
|
||||
* @returns This ignite template so function calls can be chained.
|
||||
*/
|
||||
target(value, converter = null) {
|
||||
return this.attribute("target", value, converter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name attribute of the element to be constructed by this template.
|
||||
* @param {String|IgniteProperty} value The value to set for the name attribute of the element to be constructed by this template.
|
||||
|
Loading…
x
Reference in New Issue
Block a user