forked from phoedos/pmd
#1274 Support EL in tag attributes
Adding support to EL in tag attributes <font size="2" ${something ? 'class=\"red\"' : ''}> <c:out value="some value" /> </font>
This commit is contained in:
@@ -248,7 +248,7 @@ PARSER_END(JspParser)
|
||||
|
||||
<InTagState> TOKEN :
|
||||
{
|
||||
<ATTR_NAME: <IDENTIFIER> >
|
||||
<ATTR_NAME: (<IDENTIFIER> | "${" (<QUOTED_STRING> | <TEXT_IN_EL>)* "}") >
|
||||
| <TAG_END: ">" > : AfterTagState
|
||||
| <DECL_END: ("?>" | "!>") > : AfterTagState
|
||||
| <TAG_SLASHEND: "/>" > : AfterTagState
|
||||
|
@@ -29,7 +29,21 @@ public class JspParserTest {
|
||||
"<span class=\"CostUnit\">$</span><span class=\"CostMain\">129</span><span class=\"CostFrac\">.00</span>");
|
||||
Assert.assertNotNull(node);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParseELAttribute() {
|
||||
Node node = parse(
|
||||
"<div ${something ? 'class=\"red\"' : ''}> Div content here.</div>");
|
||||
Assert.assertNotNull(node);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseELAttributeValue() {
|
||||
Node node = parse(
|
||||
"<div class=\"${something == 0 ? 'zero_something' : something == 1 ? 'one_something' : 'other_something'}\">Div content here.</div>");
|
||||
Assert.assertNotNull(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies bug #311 Jsp parser fails on boolean attribute
|
||||
*/
|
||||
|
Reference in New Issue
Block a user