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/__GetComputedStyleByKey.md.
Lynx
  • English
  • __GetComputedStyleByKey

    Introduction

    Returns the resolved style value for a CSS property of an element

    Syntax

    __GetComputedStyleByKey(element: Element, key: string) : string;

    Parameters

    KeyDescription
    elementAny Element object.
    keyA string indicating the CSS property key to be retrieved. Keep in mind that not every CSS property is supported. Refer to the Compatibility table to see which properties are supported.

    Return Value

    Resolved style value for a CSS property of specified element.

    Caution

    Unlike browser, this PAPI won't trigger document reflow.

    Example

    The frontend framework can retrieve resolved style value of an Element as follows.

    // main-thread.js
    let page = __CreateElement('page', 0, {});
    
    let element = __CreateElement('view', 0, {});
    __SetInlineStyles(element, {
      top: '10px',
      left: '10px',
      right: '10px',
      bottom: '10px',
    });
    
    __AppendElement(page, element);
    __FlushElementTree(page, {});
    
    let width = __GetComputedStyleByKey(element, 'width');

    Compatability

    LCD tables only load in the browser

    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.