mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 13:09:34 +02:00
lazutils: TDOMNode.GetLevel
git-svn-id: trunk@35467 -
This commit is contained in:
parent
e307672e60
commit
75e607c431
@ -277,6 +277,7 @@ type
|
||||
function GetNextNodeSkipChildren: TDOMNode; // first next sibling, then next sibling of parent, ...
|
||||
function GetPrevNode: TDOMNode; // the reverse of GetNext
|
||||
function GetLastLeaf: TDOMNode; // get last child of last child of ...
|
||||
function GetLevel: integer; // root node has 0
|
||||
|
||||
function InsertBefore(NewChild, RefChild: TDOMNode): TDOMNode; virtual;
|
||||
function ReplaceChild(NewChild, OldChild: TDOMNode): TDOMNode; virtual;
|
||||
@ -1070,6 +1071,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDOMNode.GetLevel: integer;
|
||||
var
|
||||
Node: TDOMNode;
|
||||
begin
|
||||
Result:=0;
|
||||
Node:=ParentNode;
|
||||
while Node<>nil do begin
|
||||
inc(Result);
|
||||
Node:=Node.ParentNode;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDOMNode.GetFirstChild: TDOMNode;
|
||||
begin
|
||||
Result := nil;
|
||||
|
Loading…
Reference in New Issue
Block a user