You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Scott Walter (JIRA)" <ta...@jakarta.apache.org> on 2005/07/26 17:14:18 UTC

[jira] Created: (TAPESTRY-443) Template Parsing Regression

Template Parsing Regression
---------------------------

         Key: TAPESTRY-443
         URL: http://issues.apache.org/jira/browse/TAPESTRY-443
     Project: Tapestry
        Type: Bug
  Components: Framework  
    Versions: 4.0    
    Reporter: Scott Walter
    Priority: Blocker


I have this snippet of javascript in one of my pages:

	<script>
		function changeTool() {
			
			for(i = 0; i<5;i++) {
				toolDiv = document.getElementById("tool" + i);
				if(i==document.$Form$0.$PropertySelection.selectedIndex) {
					toolDiv.style.visibility = "visible";
					toolDiv.style.display = "block";
				} else {
					toolDiv.style.visibility = "hidden";
					toolDiv.style.display = "none";					
				}
			}
		}
	</script>

This worked under beta 2, but failes under beta 3 with:

Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.

I should be able to set the value of an attribute more than once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: [jira] Commented: (TAPESTRY-443) Template Parsing Regression

Posted by Jesse Kuhnert <jk...@gmail.com>.
This is starting to sound like quite a sticky wicket. I solved my own 
problems by writing a string utiltity class to parse the <script></script> 
node contents of a return response and add <![CDATA style comment tags 
around the contents (stealing prototype's reg expression). This has worked 
out nicely for me thus far...So people can write javascript blocks just as 
they always have, with the help of component insertions or not...

Of course, it would seem that CDATA tags should technically be honored and 
not mutilated by normal rendering, but maybe that's not really a fair 
requirement for an html template parser, but something that may come as an 
XHtmlMarkupWriter, or something similar? Of course, that's not going to be 
enough because the parser seems to be doing some of the dirty work..

I've read documentation in other frameworks where tags similar to what you 
mentioned, being able to define blocks as "xhtml" blocks that will produce 
different sorts of elements and theoretically parse differently, are used to 
control some of this behaviour. I don't know enough about "xhtml" and how 
and why people are using it to give a strong opinion but it sort of sounds 
good? 


On 8/26/05, Geoff Longman <gl...@gmail.com> wrote:
> 
> I wonder if it would be too much to add a new "directive".
> 
> tags containing jwcid="$remove$" are actually "ignored" completely by
> the TemplateParser (except for looking for components inside the
> ignored block)
> 
> perhaps $block$ - treated as a block of text that is kept by the
> parser but is assumed to contain no dynamic markup (component refs).
> 
> the markup in the report becomes..
> 
> 
> > <script jwcid="$block$>
> > function changeTool() {
> >
> > for(i = 0; i<5;i++) {
> > toolDiv = document.getElementById("tool" + i);
> > if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> > toolDiv.style.visibility = "visible";
> > toolDiv.style.display = "block";
> > } else {
> > toolDiv.style.visibility = "hidden";
> > toolDiv.style.display = "none";
> > }
> > }
> > }
> > </script>
> 
> 
> Geoff
> 
> 
> 
> On 8/26/05, Jesse Kuhnert (JIRA) <ta...@jakarta.apache.org> wrote:
> > [ 
> http://issues.apache.org/jira/browse/TAPESTRY-443?page=comments#action_12320157]
> >
> > Jesse Kuhnert commented on TAPESTRY-443:
> > ----------------------------------------
> >
> > This is turning out to be a very real problem for my particular uses. 
> The html comment method doesn't work, if you are creating javascript logic 
> that uses <span jwcid="@Insert" /> blocks to create some of the javascript 
> logic.
> >
> > Granted, this probably isn't the best way for users to do it, but it 
> will just be another thing that needs to be documented and that users will 
> probably run into quite often.
> >
> > Luckily I have direct control over the IMarkupWriter in the portion of 
> tapestry that I care about for this scenerio, so I will be able to regex for 
> <script> tags and add //<![CDATA[ blocks around them (if they don't exist 
> already), but this might need to be re-evaluated later....
> >
> > The reason for it is that some ajax libraries manipulate the returned 
> ajax response as content within xml nodes, and javascript is not valid xml 
> content. Prototype doesn't do this, it handles the response as just one blob 
> of text, but Prototype also doesn't support multi-part (by multi-part I mean 
> multiple html element id nodes) refreshes either, so this becomes less 
> compelling..
> >
> > Ie the return might look sort of like:
> > <xml blah blah>
> > <ajax-response>
> > <response-element id="nodeId" >
> > html content here...
> > + some javascript..whatever
> > </repsonse-element>
> > <response-element id="anotherNode">
> > Here is some more html
> > </response-element>
> > </ajax-response>
> >
> > Anyways, it isn't hurting my dev efforts (anymore, now that I know 
> what's going on), but I think once we release the next version of tacos, or 
> when more people start trying to use ajax with tapestry you're going to 
> start getting bombarded with issues like this.
> >
> > I can take a stab at a patch if you want.
> >
> > > Template Parsing Regression
> > > ---------------------------
> > >
> > > Key: TAPESTRY-443
> > > URL: http://issues.apache.org/jira/browse/TAPESTRY-443
> > > Project: Tapestry
> > > Type: Bug
> > > Components: Framework
> > > Versions: 4.0
> > > Reporter: Scott Walter
> > > Assignee: Howard M. Lewis Ship
> >
> > >
> > > I have this snippet of javascript in one of my pages:
> > > <script>
> > > function changeTool() {
> > >
> > > for(i = 0; i<5;i++) {
> > > toolDiv = document.getElementById("tool" + i);
> > > if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> > > toolDiv.style.visibility = "visible";
> > > toolDiv.style.display = "block";
> > > } else {
> > > toolDiv.style.visibility = "hidden";
> > > toolDiv.style.display = "none";
> > > }
> > > }
> > > }
> > > </script>
> > > This worked under beta 2, but failes under beta 3 with:
> > > Tag <5;i++)> on line 12 contains more than one '
> toolDiv.style.visibility' attribute.
> > > I should be able to set the value of an attribute more than once.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> > http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> > http://www.atlassian.com/software/jira
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> >
> >
> 
> 
> --
> The Spindle guy. http://spindle.sf.net
> Get help with Spindle:
> http://lists.sourceforge.net/mailman/listinfo/spindle-user
> Announcement Feed:
> http://www.jroller.com/rss/glongman?catname=/Announcements
> Feature Updates: http://spindle.sf.net/updates
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
>

Re: [jira] Commented: (TAPESTRY-443) Template Parsing Regression

Posted by Geoff Longman <gl...@gmail.com>.
I wonder if it would be too much to add a new "directive".

tags containing jwcid="$remove$"  are actually "ignored" completely by
the TemplateParser (except for looking for components inside the
ignored block)

perhaps $block$ - treated as a block of text that is kept by the
parser but is assumed to contain no dynamic markup (component refs).

the markup in the report becomes..


>       <script jwcid="$block$>
>               function changeTool() {
>
>                       for(i = 0; i<5;i++) {
>                               toolDiv = document.getElementById("tool" + i);
>                               if(i==document.$Form$0.$PropertySelection.selectedIndex) {
>                                       toolDiv.style.visibility = "visible";
>                                       toolDiv.style.display = "block";
>                               } else {
>                                       toolDiv.style.visibility = "hidden";
>                                       toolDiv.style.display = "none";
>                               }
>                       }
>               }
>       </script>


Geoff



On 8/26/05, Jesse Kuhnert (JIRA) <ta...@jakarta.apache.org> wrote:
>     [ http://issues.apache.org/jira/browse/TAPESTRY-443?page=comments#action_12320157 ]
> 
> Jesse Kuhnert commented on TAPESTRY-443:
> ----------------------------------------
> 
> This is turning out to be a very real problem for my particular uses. The html comment method doesn't work, if you are creating javascript logic that uses <span jwcid="@Insert" /> blocks to create some of the javascript logic.
> 
> Granted, this probably isn't the best way for users to do it, but it will just be another thing that needs to be documented and that users will probably run into quite often.
> 
> Luckily I have direct control over the IMarkupWriter in the portion of tapestry that I care about for this scenerio, so I will be able to regex for <script> tags and add //<![CDATA[ blocks around them (if they don't exist already), but this might need to be re-evaluated later....
> 
> The reason for it is that some ajax libraries manipulate the returned ajax response as content within xml nodes, and javascript is not valid xml content. Prototype doesn't do this, it handles the response as just one blob of text, but Prototype also doesn't support multi-part (by multi-part I mean multiple html element id nodes) refreshes either, so this becomes less compelling..
> 
> Ie the return might look sort of like:
> <xml blah blah>
> <ajax-response>
> <response-element id="nodeId" >
>  html content here...
> + some javascript..whatever
> </repsonse-element>
> <response-element id="anotherNode">
> Here is some more html
> </response-element>
> </ajax-response>
> 
> Anyways, it isn't hurting my dev efforts (anymore, now that I know what's going on), but I think once we release the next version of tacos, or when more people start trying to use ajax with tapestry you're going to start getting bombarded with issues like this.
> 
> I can take a stab at a patch if you want.
> 
> > Template Parsing Regression
> > ---------------------------
> >
> >          Key: TAPESTRY-443
> >          URL: http://issues.apache.org/jira/browse/TAPESTRY-443
> >      Project: Tapestry
> >         Type: Bug
> >   Components: Framework
> >     Versions: 4.0
> >     Reporter: Scott Walter
> >     Assignee: Howard M. Lewis Ship
> 
> >
> > I have this snippet of javascript in one of my pages:
> >       <script>
> >               function changeTool() {
> >
> >                       for(i = 0; i<5;i++) {
> >                               toolDiv = document.getElementById("tool" + i);
> >                               if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> >                                       toolDiv.style.visibility = "visible";
> >                                       toolDiv.style.display = "block";
> >                               } else {
> >                                       toolDiv.style.visibility = "hidden";
> >                                       toolDiv.style.display = "none";
> >                               }
> >                       }
> >               }
> >       </script>
> > This worked under beta 2, but failes under beta 3 with:
> > Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.
> > I should be able to set the value of an attribute more than once.
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
> 


-- 
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Commented: (TAPESTRY-443) Template Parsing Regression

Posted by "Geoff Longman (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-443?page=comments#action_12316771 ] 

Geoff Longman commented on TAPESTRY-443:
----------------------------------------

The real question is: Why is the TapestryParser working over a <script> as if it has a jwcid attribute?

> Template Parsing Regression
> ---------------------------
>
>          Key: TAPESTRY-443
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-443
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Scott Walter
>     Priority: Blocker

>
> I have this snippet of javascript in one of my pages:
> 	<script>
> 		function changeTool() {
> 			
> 			for(i = 0; i<5;i++) {
> 				toolDiv = document.getElementById("tool" + i);
> 				if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> 					toolDiv.style.visibility = "visible";
> 					toolDiv.style.display = "block";
> 				} else {
> 					toolDiv.style.visibility = "hidden";
> 					toolDiv.style.display = "none";					
> 				}
> 			}
> 		}
> 	</script>
> This worked under beta 2, but failes under beta 3 with:
> Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.
> I should be able to set the value of an attribute more than once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Updated: (TAPESTRY-443) Template Parsing Regression

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-443?page=all ]

Howard M. Lewis Ship updated TAPESTRY-443:
------------------------------------------

    Assign To: Howard M. Lewis Ship
     Priority: Major  (was: Blocker)

> Template Parsing Regression
> ---------------------------
>
>          Key: TAPESTRY-443
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-443
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Scott Walter
>     Assignee: Howard M. Lewis Ship

>
> I have this snippet of javascript in one of my pages:
> 	<script>
> 		function changeTool() {
> 			
> 			for(i = 0; i<5;i++) {
> 				toolDiv = document.getElementById("tool" + i);
> 				if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> 					toolDiv.style.visibility = "visible";
> 					toolDiv.style.display = "block";
> 				} else {
> 					toolDiv.style.visibility = "hidden";
> 					toolDiv.style.display = "none";					
> 				}
> 			}
> 		}
> 	</script>
> This worked under beta 2, but failes under beta 3 with:
> Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.
> I should be able to set the value of an attribute more than once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Resolved: (TAPESTRY-443) Template Parsing Regression

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-443?page=all ]
     
Howard M. Lewis Ship resolved TAPESTRY-443:
-------------------------------------------

    Resolution: Won't Fix

Two issues:
#1 Use HTML comments around your script block.  That should resolve the problem.
#2 Your JavaScript is fragile; it will be broken by beta-5 because you are second guessing element names; instead create a script template and pass the form and PropertySelection into it, to generate proper client-side element references using the names and/or ids generated by Tapestry.

> Template Parsing Regression
> ---------------------------
>
>          Key: TAPESTRY-443
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-443
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Scott Walter
>     Assignee: Howard M. Lewis Ship

>
> I have this snippet of javascript in one of my pages:
> 	<script>
> 		function changeTool() {
> 			
> 			for(i = 0; i<5;i++) {
> 				toolDiv = document.getElementById("tool" + i);
> 				if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> 					toolDiv.style.visibility = "visible";
> 					toolDiv.style.display = "block";
> 				} else {
> 					toolDiv.style.visibility = "hidden";
> 					toolDiv.style.display = "none";					
> 				}
> 			}
> 		}
> 	</script>
> This worked under beta 2, but failes under beta 3 with:
> Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.
> I should be able to set the value of an attribute more than once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Commented: (TAPESTRY-443) Template Parsing Regression

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-443?page=comments#action_12319798 ] 

Howard M. Lewis Ship commented on TAPESTRY-443:
-----------------------------------------------

Odd; don't see any significant changes between beta-2 and HEAD.

Ahh ... there we go:

    private void addAttributeIfUnique(String tagName, String attributeName, String attributeValue)
            throws TemplateParseException
    {

        if (_attributes.containsKey(attributeName))
            templateParseProblem(
                    ParseMessages.duplicateTagAttribute(tagName, _line, attributeName),
                    getCurrentLocation(),
                    _line,
                    _cursor);

        _attributes.put(attributeName, attributeValue);
    }

So, the question is, can this be fixed?  Answer, not worth it.  Just look at the JavaScript he's using ... that will definately break in beta-5 because the way in which element names and ids are generated has changed.  This need to be converted into a script template.

> Template Parsing Regression
> ---------------------------
>
>          Key: TAPESTRY-443
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-443
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Scott Walter
>     Assignee: Howard M. Lewis Ship

>
> I have this snippet of javascript in one of my pages:
> 	<script>
> 		function changeTool() {
> 			
> 			for(i = 0; i<5;i++) {
> 				toolDiv = document.getElementById("tool" + i);
> 				if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> 					toolDiv.style.visibility = "visible";
> 					toolDiv.style.display = "block";
> 				} else {
> 					toolDiv.style.visibility = "hidden";
> 					toolDiv.style.display = "none";					
> 				}
> 			}
> 		}
> 	</script>
> This worked under beta 2, but failes under beta 3 with:
> Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.
> I should be able to set the value of an attribute more than once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Commented: (TAPESTRY-443) Template Parsing Regression

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-443?page=comments#action_12320157 ] 

Jesse Kuhnert commented on TAPESTRY-443:
----------------------------------------

This is turning out to be a very real problem for my particular uses. The html comment method doesn't work, if you are creating javascript logic that uses <span jwcid="@Insert" /> blocks to create some of the javascript logic. 

Granted, this probably isn't the best way for users to do it, but it will just be another thing that needs to be documented and that users will probably run into quite often. 

Luckily I have direct control over the IMarkupWriter in the portion of tapestry that I care about for this scenerio, so I will be able to regex for <script> tags and add //<![CDATA[ blocks around them (if they don't exist already), but this might need to be re-evaluated later....

The reason for it is that some ajax libraries manipulate the returned ajax response as content within xml nodes, and javascript is not valid xml content. Prototype doesn't do this, it handles the response as just one blob of text, but Prototype also doesn't support multi-part (by multi-part I mean multiple html element id nodes) refreshes either, so this becomes less compelling..

Ie the return might look sort of like:
<xml blah blah>
<ajax-response>
<response-element id="nodeId" >
 html content here...
+ some javascript..whatever
</repsonse-element>
<response-element id="anotherNode">
Here is some more html
</response-element>
</ajax-response>

Anyways, it isn't hurting my dev efforts (anymore, now that I know what's going on), but I think once we release the next version of tacos, or when more people start trying to use ajax with tapestry you're going to start getting bombarded with issues like this. 

I can take a stab at a patch if you want. 

> Template Parsing Regression
> ---------------------------
>
>          Key: TAPESTRY-443
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-443
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Scott Walter
>     Assignee: Howard M. Lewis Ship

>
> I have this snippet of javascript in one of my pages:
> 	<script>
> 		function changeTool() {
> 			
> 			for(i = 0; i<5;i++) {
> 				toolDiv = document.getElementById("tool" + i);
> 				if(i==document.$Form$0.$PropertySelection.selectedIndex) {
> 					toolDiv.style.visibility = "visible";
> 					toolDiv.style.display = "block";
> 				} else {
> 					toolDiv.style.visibility = "hidden";
> 					toolDiv.style.display = "none";					
> 				}
> 			}
> 		}
> 	</script>
> This worked under beta 2, but failes under beta 3 with:
> Tag <5;i++)> on line 12 contains more than one 'toolDiv.style.visibility' attribute.
> I should be able to set the value of an attribute more than once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org