docs(ivy): update the API docs instructions to add details about removing attributes (#22268)
PR Close #22268
This commit is contained in:
parent
c9ebd60435
commit
31c5c1060a
|
@ -634,23 +634,23 @@ export function elementEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an attribute on an Element. This is used with a `bind` instruction.
|
* Updates the value of removes an attribute on an Element.
|
||||||
*
|
*
|
||||||
* @param index The index of the element to update in the data array
|
* @param number index The index of the element in the data array
|
||||||
* @param attrName Name of attribute. Because it is going to DOM, this is not subject to
|
* @param string name The name of the attribute.
|
||||||
* renaming as port of minification.
|
* @param any value The attribute is removed when value is `null` or `undefined`.
|
||||||
* @param value Value to write. This value will go through stringification.
|
* Otherwise the attribute value is set to the stringified value.
|
||||||
*/
|
*/
|
||||||
export function elementAttribute(index: number, attrName: string, value: any): void {
|
export function elementAttribute(index: number, name: string, value: any): void {
|
||||||
if (value !== NO_CHANGE) {
|
if (value !== NO_CHANGE) {
|
||||||
const element = data[index] as LElementNode;
|
const element: LElementNode = data[index];
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
isProceduralRenderer(renderer) ? renderer.removeAttribute(element.native, attrName) :
|
isProceduralRenderer(renderer) ? renderer.removeAttribute(element.native, name) :
|
||||||
element.native.removeAttribute(attrName);
|
element.native.removeAttribute(name);
|
||||||
} else {
|
} else {
|
||||||
isProceduralRenderer(renderer) ?
|
isProceduralRenderer(renderer) ?
|
||||||
renderer.setAttribute(element.native, attrName, stringify(value)) :
|
renderer.setAttribute(element.native, name, stringify(value)) :
|
||||||
element.native.setAttribute(attrName, stringify(value));
|
element.native.setAttribute(name, stringify(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue