You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Tuukka Mustonen (JIRA)" <ji...@apache.org> on 2010/03/23 09:28:27 UTC

[jira] Updated: (WICKET-2795) Wicket removes first dollar from $$ markups with TextTemplate's interpolate() while $$ are commonly used in JavaScript libraries

     [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tuukka Mustonen updated WICKET-2795:
------------------------------------

    Description: 
Many JavaScript libraries such as jQuery and MooTools use $$ to find out arrays of elements. Having $$('blaa') is currently replaced by Wicket into $('blaa'). Wanted behavior is to replace all $${...} with ${...}, not $$ with $.

Possible fix (don't really have time to look at this atm):

org.apache.wicket.util.template.VariableInterpolator:

Row 111:

		while ((start = lowerPositive(string.indexOf("$$", pos), string.indexOf("${", pos))) != -1)
		{
			// Append text before possible variable
			buffer.append(string.substring(pos, start));

			if (string.charAt(start + 1) == '$')
			{
				buffer.append("$");
				pos = start + 2;
				continue;
			}
		...

Shoud be changed to:

		while ((start = lowerPositive(string.indexOf("$$*{*", pos), string.indexOf("${", pos))) != -1)
		{
			// Append text before possible variable
			buffer.append(string.substring(pos, start));

			if (string.charAt(start + 1) == '$' **&& string.charAt(start + 2) == '{'**)
			{
				buffer.append("$**{**");
				pos = start + **3**;
				continue;
			}
		...

  was:
Many JavaScript libraries such as jQuery and MooTools use $$ to find out arrays of elements. Having $$('blaa') is currently replaced by Wicket into $('blaa'). Wanted behavior is to replace all $${...} with ${...}, not $$ with $.

Possible fix (don't really have time to look at this atm):

org.apache.wicket.util.template.VariableInterpolator:

Row 111:

		while ((start = lowerPositive(string.indexOf("$$", pos), string.indexOf("${", pos))) != -1)
		{
			// Append text before possible variable
			buffer.append(string.substring(pos, start));

			if (string.charAt(start + 1) == '$')
			{
				buffer.append("$");
				pos = start + 2;
				continue;
			}
		...

Shoud be changed to:

		while ((start = lowerPositive(string.indexOf("$$**{**", pos), string.indexOf("${", pos))) != -1)
		{
			// Append text before possible variable
			buffer.append(string.substring(pos, start));

			if (string.charAt(start + 1) == '$' **&& string.charAt(start + 2) == '{'**)
			{
				buffer.append("$**{**");
				pos = start + **3**;
				continue;
			}
		...


> Wicket removes first dollar from $$ markups with TextTemplate's interpolate() while $$ are commonly used in JavaScript libraries
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2795
>                 URL: https://issues.apache.org/jira/browse/WICKET-2795
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.6
>         Environment: Windows XP SP3, Apache Jetty 6.1.22
>            Reporter: Tuukka Mustonen
>
> Many JavaScript libraries such as jQuery and MooTools use $$ to find out arrays of elements. Having $$('blaa') is currently replaced by Wicket into $('blaa'). Wanted behavior is to replace all $${...} with ${...}, not $$ with $.
> Possible fix (don't really have time to look at this atm):
> org.apache.wicket.util.template.VariableInterpolator:
> Row 111:
> 		while ((start = lowerPositive(string.indexOf("$$", pos), string.indexOf("${", pos))) != -1)
> 		{
> 			// Append text before possible variable
> 			buffer.append(string.substring(pos, start));
> 			if (string.charAt(start + 1) == '$')
> 			{
> 				buffer.append("$");
> 				pos = start + 2;
> 				continue;
> 			}
> 		...
> Shoud be changed to:
> 		while ((start = lowerPositive(string.indexOf("$$*{*", pos), string.indexOf("${", pos))) != -1)
> 		{
> 			// Append text before possible variable
> 			buffer.append(string.substring(pos, start));
> 			if (string.charAt(start + 1) == '$' **&& string.charAt(start + 2) == '{'**)
> 			{
> 				buffer.append("$**{**");
> 				pos = start + **3**;
> 				continue;
> 			}
> 		...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.