Skip to main content
Version: 1.x

Function: serializeUI5SelectorToCSS()

serializeUI5SelectorToCSS(selector): string

Converts a structured UI5Selector into a CSS-like pseudo-class selector string.

Parameters

selector

UI5Selector

The UI5 selector to serialize

Returns

string

The CSS-like pseudo-class selector string

Remarks

This is the inverse of what the CSS selector engine parses. The output format uses pseudo-class syntax like :type(sap.m.Button):prop(text, "Save").

Example

import { serializeUI5SelectorToCSS } from './selector-parser.js';

const css = serializeUI5SelectorToCSS({
controlType: 'sap.m.Button',
id: 'saveBtn',
properties: { text: 'Save' },
ancestor: { controlType: 'sap.m.Panel' },
});
// ':type(sap.m.Button)#saveBtn:prop(text, "Save"):ancestor(:type(sap.m.Panel))'