Updated Branches: refs/heads/wicket-6.x 68828cde2 -> 176a9fd4b
WICKET-5397 target.prependJavaScript and JQuery-Animation in IE8 Use RegExp to find all occurrences of a pattern in a string. String.split(RegExp) doesn't work in IE8 Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/176a9fd4 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/176a9fd4 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/176a9fd4 Branch: refs/heads/wicket-6.x Commit: 176a9fd4bd4956da62a3d3f44d2731b708aa6026 Parents: 68828cd Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Tue Oct 29 14:20:10 2013 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Tue Oct 29 14:26:33 2013 +0200 ---------------------------------------------------------------------- .../wicket/ajax/res/js/wicket-ajax-jquery.js | 24 +++++--------------- 1 file changed, 6 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/176a9fd4/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js index d5440ee..d6f9b8e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js @@ -1071,23 +1071,7 @@ * when there are scripts which require manual call of 'FunctionExecutor#notify()' * @type {RegExp} */ - var scriptSplitterR = new RegExp("(\\(function\\(\\)\\{.*?}\\)\\(\\);)"); - - /** - * Removes all empty items from an Array of String's - * @param original The array is empty string elements - * @returns {Array[String]} An array that has no empty elements - */ - // Needed because String.split(scriptSplitterR) returns something like ["", "script1", "", "script2", ""] - var cleanArray = function (original) { - var result = []; - for(var i = 0; i < original.length; i++){ - if (original[i]) { - result.push(original[i]); - } - } - return result; - }; + var scriptSplitterR = new RegExp("\\(function\\(\\)\\{.*?}\\)\\(\\);", 'gi'); // get the javascript body var text = Wicket.DOM.text(node); @@ -1136,7 +1120,11 @@ // by invoking identifier();. This allows usage of some asynchronous/deferred logic before the next script // See WICKET-5039 if (scriptWithIdentifierR.test(text)) { - var scripts = cleanArray(text.split(scriptSplitterR)); + var scripts = []; + var scr; + while ( (scr = scriptSplitterR.exec(text) ) != null ) { + scripts.push(scr[0]); + } for (var s = 0; s < scripts.length; s++) { var script = scripts[s];
