Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D56018CB5 for ; Wed, 3 Feb 2016 20:35:44 +0000 (UTC) Received: (qmail 48541 invoked by uid 500); 3 Feb 2016 20:35:41 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 48519 invoked by uid 500); 3 Feb 2016 20:35:41 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 48511 invoked by uid 99); 3 Feb 2016 20:35:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2016 20:35:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EDA5CDFC8F; Wed, 3 Feb 2016 20:35:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: harbs@apache.org To: commits@flex.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-asjs] [refs/heads/e4x] - descendents and cleanup Date: Wed, 3 Feb 2016 20:35:40 +0000 (UTC) Repository: flex-asjs Updated Branches: refs/heads/e4x dc52078ee -> 3c3a16181 descendents and cleanup Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/3c3a1618 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/3c3a1618 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/3c3a1618 Branch: refs/heads/e4x Commit: 3c3a1618192d4e74ecee9a4b7e5733f5e8523962 Parents: dc52078 Author: Harbs Authored: Wed Feb 3 22:35:36 2016 +0200 Committer: Harbs Committed: Wed Feb 3 22:35:36 2016 +0200 ---------------------------------------------------------------------- frameworks/projects/XML/as/src/XML.as | 27 +++++++- frameworks/projects/XML/as/src/XMLList.as | 86 +++++++++++++------------- 2 files changed, 67 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c3a1618/frameworks/projects/XML/as/src/XML.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/XML/as/src/XML.as b/frameworks/projects/XML/as/src/XML.as index aad27ce..a59fcf8 100644 --- a/frameworks/projects/XML/as/src/XML.as +++ b/frameworks/projects/XML/as/src/XML.as @@ -640,7 +640,7 @@ package * @return * */ - public function descendants(name:Object = *):XMLList + public function descendants(name:Object = "*"):XMLList { /* When the [[Descendants]] method of an XML object x is called with property name P, the following steps are taken: @@ -657,7 +657,28 @@ package c. If dq.[[Length]] > 0, call the [[Append]] method of list with argument dq 5. Return list */ - return null; + var i:int; + name = toXMLName(name); + var list:XMLList = new XMLList(); + if(name.isAttribute) + { + for(i=0;i<_attributes.length;i++) + { + if(name.matches(_attributes[i].name())) + list.appendChild(_attributes[i]); + } + for(i=0;i<_children.length;i++) + { + if(_children[i].nodeKind() == "element") + { + if(name.matches(_children[i].name())) + list.appendChild(_children[i]); + + list = list.concat(_children[i].descendants()); + } + } + } + return list; } /** @@ -667,7 +688,7 @@ package * @return * */ - public function elements(name:Object = *):XMLList + public function elements(name:Object = "*"):XMLList { return null; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c3a1618/frameworks/projects/XML/as/src/XMLList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/XML/as/src/XMLList.as b/frameworks/projects/XML/as/src/XMLList.as index 8eae698..9e0d2fb 100644 --- a/frameworks/projects/XML/as/src/XMLList.as +++ b/frameworks/projects/XML/as/src/XMLList.as @@ -171,10 +171,10 @@ package public function attribute(attributeName:*):XMLList { var retVal:XMLList = new XMLList(); - var len:int = this.length(); + var len:int = _xmlArray.length; for (var i:int=0;i