You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/07/23 01:57:31 UTC
[4/8] git commit: Add ElementWrapper.children()
Add ElementWrapper.children()
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/36de8382
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/36de8382
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/36de8382
Branch: refs/heads/master
Commit: 36de83828271b6f154e1c461d3a7729a522c2af6
Parents: 2ce0b5a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Jul 22 09:35:38 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Jul 22 09:35:38 2013 -0700
----------------------------------------------------------------------
.../org/apache/tapestry5/t5-core-dom.coffee | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/36de8382/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index b7e9ab8..4fa9ca4 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -445,14 +445,12 @@ define ["underscore", "./utils", "./events", "jquery"],
#if jquery
matches = @$.find selector
- return [] if matches.length is 0
-
- for i in [0..(matches.length - 1)]
+ for i in [0...matches.length]
new ElementWrapper matches.eq i
#elseif prototype
matches = @element.select selector
- _.map matches, (e) -> new ElementWrapper e
+ new ElementWrapper(e) for e in matches
#endif
# Find the first container element that matches the selector (wrapped as an ElementWrapper),
@@ -504,6 +502,18 @@ define ["underscore", "./utils", "./events", "jquery"],
#endif
new ElementWrapper parent
+ # Returns an array of all the immediate child elements of this element, as ElementWrappers.
+ children: ->
+#if jquery
+ children = @$.children()
+
+ for i in [0...matches.length]
+ new ElementWrapper children.eq i
+
+#elseif prototype
+ new ElementWrapper(e) for e in @element.childElements()
+#endif
+
# Returns true if this element is visible, false otherwise. This does not check to see if all containers of the
# element are visible.
visible: ->