For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/engine/element-api/__SwapElement.md.
Lynx
  • English
  • __SwapElement

    Introduction

    Swaps the positions of two Elements.

    Syntax

    __SwapElement(childA: Element, childB: Element) : void;

    Parameters

    KeyDescription
    childAThe first element to be swapped.
    childBThe second element to be swapped.

    Return Value

    No return value.

    Example

    The frontend framework can perform replacement operations as follows.

    // main-thread.js
    let childA = __CreateElement('view', 0, {});
    
    let childB = __CreateElement('view', 0, {});
    
    let parent = __CreateElement('view', 0, {});
    
    __AppendElement(parent, childA);
    __AppendElement(parent, childB);
    
    __SwapElement(childA, childB);
    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.