Author: hlship Date: Sat Aug 6 02:55:41 2011 New Revision: 1154437 URL: http://svn.apache.org/viewvc?rev=1154437&view=rev Log: Make more use of Underscore.js instead of ad-hoc JavaScript
Removed: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-func.js Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-dom.js tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java?rev=1154437&r1=1154436&r2=1154437&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java Sat Aug 6 02:55:41 2011 @@ -69,8 +69,6 @@ public class CoreJavaScriptStack impleme ROOT + "/t5-core.js", - ROOT + "/t5-func.js", - ROOT + "/t5-spi.js", ROOT + "/t5-prototype.js", Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js?rev=1154437&r1=1154436&r2=1154437&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js Sat Aug 6 02:55:41 2011 @@ -24,6 +24,8 @@ T5.define("ajax", function() { var $ = T5.$; var spi = T5.spi; + function noop() { } + function defaultFailure(transport) { } @@ -68,7 +70,7 @@ T5.define("ajax", function() { return { defaultFailure : defaultFailure, defaultException : defaultException, - defaultSuccess : T5.func.empty, + defaultSuccess : noop, request : request }; }); \ No newline at end of file Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-dom.js URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-dom.js?rev=1154437&r1=1154436&r2=1154437&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-dom.js (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-dom.js Sat Aug 6 02:55:41 2011 @@ -36,7 +36,8 @@ T5.define("dom", function() { * and is returned. */ function locate(element) { - if (typeof element == "string") { + + if (_.isString(element)) { return document.getElementById(element); } @@ -83,8 +84,7 @@ T5.define("dom", function() { purgeChildren(element); if (element.t5pubsub) { - // TODO: Execute this deferred? - T5.pubsub.cleanupRemovedElement(element); + _.defer(function() { T5.pubsub.cleanupRemovedElement(element) }); } doRemoveEventHandlers(element); Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml?rev=1154437&r1=1154436&r2=1154437&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml Sat Aug 6 02:55:41 2011 @@ -87,39 +87,6 @@ </pre> </div> -<div> - <p>Removing an element also removes publishers and subscribers for the element.</p> - <pre> - var pubs = [] - - var element = new Element("span").update("Published Message Source") - - document.body.insert({bottom: element}) - - sub("bar", null, function() { pubs.push("general") }) - sub("bar", element, - function() { pubs.push("specific") } ) - - pub("bar", element, {}) - - assertEqual(pubs, ["specific", "general"]) - - T5.dom.remove(element) - - pubs = [] - - pub("bar", element, {}) - - assertEqual(pubs, ["general"]) - - pubs = [] - - pub("bar", - document.body, {}) - - assertEqual(pubs, ["general"]) - </pre> -</div> <div> <p>Publish/subscribe via client id rather than element.</p>