Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.1
-
Fix Version/s: 1.7.2
-
Component/s: ICE-Components
-
Labels:None
-
Environment:all
Description
Putting a script into an ICEfaces page
<script type="text/javascript">
alert("Beep");
</script>
Currently gets rendered out as:
<script type="text/javascript">
<span id = "_components_buttonsAndLinks_WAR_componentshowcase_INSTANCE_2nr4_ :j_id4">alert("Beep");</span>
</script>
Wrapping the contents in a <span> causes the code to, obviously, not execute. The problem surfaces in the 1.7 branch on revision 17279.
The problem according to Mark is:
With JSF 1.1, generated ids are of the form _idNUMBER, whereas with JSF 1.2, they are j_id_NUMBER.
In TextRenderer, part of the logic to have a span is:
if (idNotNull(uiComponent) && !uiComponent.getId().startsWith("_")) {
return true;
}
Which means, if the component has an id, and it was specifically given, and not generated, than use a span. But the heuristic for it not being generated was for JSF 1.1, not JSF 1.2. It worked out, because we had put in place our own generated id scheme, for plain text, that was _iceIDNUMBER, which started with the underscore. Changing that to use the JSF 1.2 generated id broke things.
The solution is not to back out the generated id fix. Instead we could update TextRenderer to use a better heuristic for having a specified id. Or we could just set a flag on OutputText, so it will just not put spans around plain text. There's the little question of when <ice:outputText> is used (and not plain text), and no id was given, so it's generated, what we're supposed to do, use a span or not.
<script type="text/javascript">
alert("Beep");
</script>
Currently gets rendered out as:
<script type="text/javascript">
<span id = "_components_buttonsAndLinks_WAR_componentshowcase_INSTANCE_2nr4_ :j_id4">alert("Beep");</span>
</script>
Wrapping the contents in a <span> causes the code to, obviously, not execute. The problem surfaces in the 1.7 branch on revision 17279.
The problem according to Mark is:
With JSF 1.1, generated ids are of the form _idNUMBER, whereas with JSF 1.2, they are j_id_NUMBER.
In TextRenderer, part of the logic to have a span is:
if (idNotNull(uiComponent) && !uiComponent.getId().startsWith("_")) {
return true;
}
Which means, if the component has an id, and it was specifically given, and not generated, than use a span. But the heuristic for it not being generated was for JSF 1.1, not JSF 1.2. It worked out, because we had put in place our own generated id scheme, for plain text, that was _iceIDNUMBER, which started with the underscore. Changing that to use the JSF 1.2 generated id broke things.
The solution is not to back out the generated id fix. Instead we could update TextRenderer to use a better heuristic for having a specified id. Or we could just set a flag on OutputText, so it will just not put spans around plain text. There's the little question of when <ice:outputText> is used (and not plain text), and no id was given, so it's generated, what we're supposed to do, use a span or not.
Issue Links
Activity
Deryk Sinotte
created issue -
Deryk Sinotte
made changes -
Field | Original Value | New Value |
---|---|---|
Component/s | Components [ 10012 ] | |
Fix Version/s | 1.7.2 [ 10130 ] | |
Affects Version/s | 1.7.1 [ 10122 ] | |
Assignee | Mark Collette [ mark.collette ] |
Deryk Sinotte
made changes -
Ken Fyten
made changes -
Assignee Priority | P3 |
Ken Fyten
made changes -
Assignee Priority | P3 | P1 |
Ken Fyten
made changes -
Assignee | Mark Collette [ mark.collette ] | Yip Ng [ yip.ng ] |
Ken Fyten
made changes -
Fix Version/s | 1.7.2RC1 [ 10140 ] | |
Fix Version/s | 1.7.2 [ 10130 ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #17529 | Tue Sep 09 14:47:42 MDT 2008 | yip.ng | Changed to not render <span> tags for <script>, <style> and <title> tags. |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/parser/IceOutputTextTag.java
|
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #17530 | Tue Sep 09 14:56:58 MDT 2008 | yip.ng | Changed to not render <span> tags for <script>, <style> and <title> tags. |
Files Changed | ||||
MODIFY
/icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/parser/IceOutputTextTag.java
|
Attachment | screenshot-1.jpg [ 11231 ] |
Attachment | screenshot-2.jpg [ 11233 ] |
Attachment | screenshot-3.jpg [ 11234 ] |
yip.ng
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Fix Version/s | 1.7.2 [ 10130 ] | |
Fix Version/s | 1.7.2RC1 [ 10140 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee Priority | P1 | |
Assignee | Yip Ng [ yip.ng ] |
Hi,
on the current svn, The content of <style> tags are being wrapped by <span> tags too.
regards,