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/06/13 00:50:19 UTC

[2/3] git commit: Provide a toString() on implementations of ElementWrapper

Provide a toString() on implementations of ElementWrapper


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7439533b
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7439533b
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7439533b

Branch: refs/heads/master
Commit: 7439533bcb72891b6b6a075a5bc58d82417f6816
Parents: 5898990
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Wed Jun 12 13:55:26 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed Jun 12 13:55:26 2013 -0700

----------------------------------------------------------------------
 .../org/apache/tapestry5/t5-core-dom-jquery.coffee            | 5 +++++
 .../org/apache/tapestry5/t5-core-dom-prototype.coffee         | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7439533b/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-jquery.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-jquery.coffee b/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-jquery.coffee
index a55e45e..80cc099 100644
--- a/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-jquery.coffee
+++ b/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-jquery.coffee
@@ -118,6 +118,11 @@ define ["underscore", "./utils", "jquery", "./events"], (_, utils, $, events) ->
     # Some coders would use some JavaScript cleverness to automate more of the mapping from the ElementWrapper API
     # to the jQuery API, but that eliminates a chance to write some very necessary documentation.
 
+    toString: ->
+      markup = @element.outerHTML
+
+      "ElementWrapper[#{markup.substring 0, (markup.indexOf ">") + 1}]"
+
     # Hides the wrapped element, setting its display to 'none'.
     hide: ->
       @$.hide()

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7439533b/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-prototype.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-prototype.coffee b/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-prototype.coffee
index 9bd01a1..04c7b37 100644
--- a/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-prototype.coffee
+++ b/tapestry-core/src/main/coffeescript/org/apache/tapestry5/t5-core-dom-prototype.coffee
@@ -161,7 +161,12 @@ define ["underscore", "./utils", "./events", "prototype"], (_, utils, events) ->
   # Passed the DOM Element
     constructor: (@element) ->
 
-      # Hides the wrapped element, setting its display to 'none'.
+    toString: ->
+      markup = @element.outerHTML
+
+      "ElementWrapper[#{markup.substring 0, (markup.indexOf ">") + 1}]"
+
+    # Hides the wrapped element, setting its display to 'none'.
     hide: ->
       @element.hide()