Author: ivaynberg
Date: Sat Mar 26 06:07:30 2011
New Revision: 1085653
URL: http://svn.apache.org/viewvc?rev=1085653&view=rev
Log:
Issue: WICKET-3473
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=1085653&r1=1085652&r2=1085653&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
(original)
+++
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
Sat Mar 26 06:07:30 2011
@@ -122,6 +122,7 @@ Wicket.Log = {
}
},
+
/**
* Functions executer takes array of functions and executes them. Each
function gets
* the notify object, which needs to be called for the next function to be
executed.
@@ -168,6 +169,12 @@ Wicket.FunctionsExecuter.prototype = {
}
}
+/*
+ WICKET-3473 Helper to proceed to next step, execution of notify needs to be
delayed until the head contributions are loaded
+*/
+Wicket.functionExecuterSeq = 0;
+Wicket.functionExecuterCallbacks = {};
+
Wicket.replaceOuterHtmlIE = function(element, text) {
// replaces all <iframe references with
<__WICKET_JS_REMOVE_X9F4A__iframe text
@@ -1630,12 +1637,13 @@ Wicket.Head.Contributor.prototype = {
// load the external javascript using
Wicket.Ajax.Request
// callback when script is loaded
- var onLoad = function(content) {
- Wicket.Head.addJavascript(content,
null, src);
- Wicket.Ajax.invokePostCallHandlers();
-
- // continue to next step
- notify();
+ var callBackIdentifier = 'script' +
(Wicket.functionExecuterSeq++);
+ var onLoad = function(content) {
+ Wicket.functionExecuterCallbacks[callBackIdentifier] =
function() {
+ Wicket.Ajax.invokePostCallHandlers();
+ notify();
+ }
+ Wicket.Head.addJavascript(content+";
Wicket.functionExecuterCallbacks['"+callBackIdentifier+"'](); delete
Wicket.functionExecuterCallbacks['"+callBackIdentifier+"']; ", null, src);
}
// we need to schedule the request as timeout
// calling xml http request from another
request call stack doesn't work