You've already forked lazarus-ccr
TEmbeddedArrayStackItem.CreateList() should look only at the immediate child level of the ScopeObject
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@706 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -2137,10 +2137,10 @@ function TEmbeddedArrayStackItem.CreateList(const ANodeName: string): TDOMNodeLi
|
|||||||
begin
|
begin
|
||||||
if ScopeObject.HasChildNodes() then begin
|
if ScopeObject.HasChildNodes() then begin
|
||||||
{$IFDEF WST_DELPHI}
|
{$IFDEF WST_DELPHI}
|
||||||
Result := FilterList(ScopeObject.childNodes,ANodeName);
|
Result := FilterList(ScopeObject.ChildNodes,ANodeName);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Result := {$IFNDEF FPC_211}TDOMNodeList{$ELSE}TDOMElementList{$ENDIF}.Create(ScopeObject,ANodeName);
|
Result := FilterList(ScopeObject,ANodeName);
|
||||||
{$ENDIF}
|
{$ENDIF WST_DELPHI}
|
||||||
end else begin
|
end else begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
@ -9,6 +9,22 @@ uses
|
|||||||
{$INCLUDE wst.inc}
|
{$INCLUDE wst.inc}
|
||||||
{$INCLUDE wst_delphi.inc}
|
{$INCLUDE wst_delphi.inc}
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TDOMNodeSelectListImp }
|
||||||
|
|
||||||
|
TDOMNodeSelectListImp = class(TDOMNodeList)
|
||||||
|
private
|
||||||
|
FFilter: DOMString;
|
||||||
|
FUseFilter: Boolean;
|
||||||
|
protected
|
||||||
|
procedure BuildList(); override;
|
||||||
|
public
|
||||||
|
constructor Create(ANode: TDOMNode; const AFilter: DOMString);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FilterList(const ANode : TDOMNode; const ANodeName : DOMString) : TDOMNodeList ;
|
||||||
|
|
||||||
function GetNodeItemsCount(const ANode : TDOMNode): Integer;
|
function GetNodeItemsCount(const ANode : TDOMNode): Integer;
|
||||||
function GetNodeListCount(ANodeList : TDOMNodeList) : Integer ;overload;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetNodeListCount(ANodeList : TDOMNodeList) : Integer ;overload;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetNodeListCount(ANodeList : TDOMNamedNodeMap) : Integer ;overload;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetNodeListCount(ANodeList : TDOMNamedNodeMap) : Integer ;overload;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
@ -88,4 +104,38 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FilterList(const ANode : TDOMNode; const ANodeName : DOMString) : TDOMNodeList ;
|
||||||
|
begin
|
||||||
|
Result := TDOMNodeSelectListImp.Create(ANode,ANodeName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDOMNodeSelectListImp }
|
||||||
|
|
||||||
|
type
|
||||||
|
TDOMNodeCracked = class(TDOMNode);
|
||||||
|
procedure TDOMNodeSelectListImp.BuildList();
|
||||||
|
var
|
||||||
|
Child: TDOMNode;
|
||||||
|
begin
|
||||||
|
FList.Clear;
|
||||||
|
FRevision := TDOMNodeCracked(FNode).GetRevision();
|
||||||
|
|
||||||
|
Child := FNode.FirstChild;
|
||||||
|
while ( Child <> nil ) do begin
|
||||||
|
if ( Child.NodeType = ELEMENT_NODE ) and
|
||||||
|
( ( not FUseFilter ) or ( TDOMElement(Child).TagName = FFilter ) )
|
||||||
|
then begin
|
||||||
|
FList.Add(Child);
|
||||||
|
end;
|
||||||
|
Child := Child.NextSibling
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TDOMNodeSelectListImp.Create(ANode: TDOMNode; const AFilter: DOMString);
|
||||||
|
begin
|
||||||
|
inherited Create(ANode);
|
||||||
|
FFilter := AFilter;
|
||||||
|
FUseFilter := ( FFilter <> '*' );
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user