* Initialize, update, or remove a single component. * * When initializing, we set the component on `this.components`. * * @param {string} attr - Component name. * @param {object} attrValue - Value of the DOM attribute. * @param {boolean} clobber - If new attrValue completely replac
(attr, attrValue, clobber)
| 441 | * @param {boolean} clobber - If new attrValue completely replaces previous properties. |
| 442 | */ |
| 443 | updateComponent (attr, attrValue, clobber) { |
| 444 | var component = this.components[attr]; |
| 445 | |
| 446 | if (component) { |
| 447 | // Remove component. |
| 448 | if (attrValue === null && !checkComponentDefined(this, attr)) { |
| 449 | this.removeComponent(attr, true); |
| 450 | return; |
| 451 | } |
| 452 | // Component already initialized. Update component. |
| 453 | component.updateProperties(attrValue, clobber); |
| 454 | return; |
| 455 | } |
| 456 | |
| 457 | // Component not yet initialized. Initialize component. |
| 458 | this.initComponent(attr, attrValue, false); |
| 459 | } |
| 460 | |
| 461 | /** |
| 462 | * If `attr` is a component name, detach the component from the entity. |
no test coverage detected