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:26:27 UTC

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

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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848932#action_12848932 ] 

Igor Vaynberg commented on WICKET-2795:
---------------------------------------

btw, the point behind the escape sequence is to simply allow $ to appear anywhere in the contents. for example a template can be

$$${amountInDollars}


> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2795.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

we wont fix this because it will change existing behavior, the $$ is our escape sequence, please use $$$$ in your code

> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Tuukka Mustonen (JIRA)" <ji...@apache.org>.
     [ 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;
			}
		...

(no JIRA markup for rich formatting available? uh)

  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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Tuukka Mustonen (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Tuukka Mustonen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848907#action_12848907 ] 

Tuukka Mustonen commented on WICKET-2795:
-----------------------------------------

I think the point behind the escape sequence is to allow leaving ${....} markups in templates, and that's all, no? Putting $$$$ would brake IDE support for JavaScript (not generically, but for specific libraries).

As $variable expressions are not processed, this would be a safe thing to do.

Now:

${...} gets processed
$${...} will not get processed
$$ will get processed (and will result in strange behavior with JS calls that have curly bracers like $$("el").each(functionI() {...}); )

After changes:

${...} gets processed
$${...} will not get processed
$$ will not get processed

Quite propably I am missing something here?

> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Tuukka Mustonen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848907#action_12848907 ] 

Tuukka Mustonen edited comment on WICKET-2795 at 3/23/10 8:51 PM:
------------------------------------------------------------------

I think the point behind the escape sequence is to allow leaving ${....} markups in templates, and that's all, no? Putting $$$$ would brake IDE support for JavaScript (not generically, but for specific libraries).

As $variable expressions are not processed, this would be a safe thing to do.

Now:

${...} gets interpolated
$${...} gets turned into ${...}
$$ will get processed (and will result in strange results with JS calls that have curly bracers like $$("el").each(functionI() {...}); )

After changes:

${...} gets processed
$${...} gets turned into ${...}
$$ will not get processed

Quite propably I am missing something here?

      was (Author: tuukka.mustonen):
    I think the point behind the escape sequence is to allow leaving ${....} markups in templates, and that's all, no? Putting $$$$ would brake IDE support for JavaScript (not generically, but for specific libraries).

As $variable expressions are not processed, this would be a safe thing to do.

Now:

${...} gets processed
$${...} will not get processed
$$ will get processed (and will result in strange behavior with JS calls that have curly bracers like $$("el").each(functionI() {...}); )

After changes:

${...} gets processed
$${...} will not get processed
$$ will not get processed

Quite propably I am missing something here?
  
> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848930#action_12848930 ] 

Igor Vaynberg commented on WICKET-2795:
---------------------------------------

i understand that this is not convenient when working with javascript, unfortunately this has been in the codebase for a long time and cannot be changed without people rewriting their apps. maybe in 1.5 we can change it, but definitely not in 1.4

> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849233#action_12849233 ] 

Igor Vaynberg commented on WICKET-2795:
---------------------------------------

dont think there was a special reason, the code is quiet old.

> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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


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

Posted by "Tuukka Mustonen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849099#action_12849099 ] 

Tuukka Mustonen commented on WICKET-2795:
-----------------------------------------

Oh that's quite true, I didn't think it through.

Then, backslashes are commonly interpreted as ignore-the-next-character's-special-meaning and everyone knows about them already - was there some special reason for not selecting them for this as well so \$ for turning into $ and \\$ for turning into \$ and so on?

> 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
>            Assignee: Igor Vaynberg
>
> 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;
> 			}
> 		...
> (no JIRA markup for rich formatting available? uh)

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