mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 17:19:32 +02:00
fcl-css: added GetCSSPath
This commit is contained in:
parent
a40a3ee34d
commit
de586e55c0
@ -364,6 +364,8 @@ Function StringToCSSString(const S : UTF8String) : UTF8String;
|
||||
// Escapes non-identifier characters C to \C
|
||||
Function StringToIdentifier(const S : UTF8String) : UTF8String;
|
||||
|
||||
Function GetCSSPath(El: TCSSElement): string;
|
||||
|
||||
Const
|
||||
CSSUnitNames : Array[TCSSUnits] of string =
|
||||
('','px','%','rem','em','pt','fr','vw','vh','deg');
|
||||
@ -480,6 +482,23 @@ begin
|
||||
SetLength(Result,iOut);
|
||||
end;
|
||||
|
||||
function GetCSSPath(El: TCSSElement): string;
|
||||
begin
|
||||
if El=nil then
|
||||
exit('nil');
|
||||
Result:='';
|
||||
while El<>nil do
|
||||
begin
|
||||
if Result<>'' then
|
||||
Result:='.'+Result;
|
||||
if El is TCSSIdentifierElement then
|
||||
Result:=TCSSIdentifierElement(El).Name+Result
|
||||
else
|
||||
Result:=El.ClassName+Result;
|
||||
El:=El.Parent;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TCSSListElement }
|
||||
|
||||
function TCSSListElement.GetAsString(aFormat: Boolean; const aIndent: String): UTF8String;
|
||||
|
Loading…
Reference in New Issue
Block a user