Bug #13521
closedWT-13501 breaks WTemplate internal path encoding
100%
Description
While trying the latest updates I discovered that WT-13501, namely Commit 05e4064, introduces a breaking bug with WTemplate
internal path encoding. Having an <a>
tag inside a condition block, like ${<cond>}<a href="#/target">link</a>${</cond>}
, will lead to a javascript exception if internal path encoding is enabled and the condition is set to false.
I could trace the issue to the changes in RefEncoder.c
. Despite the <a>
tag not being included in the (rendered) template text due to the false condition, the newly introduced javascript will be created and executed regardlessly - but will not find an element with the dummy id and thus result in the aforementioned javascript exception. Interestingly this issue does not always seem to occur on inital page loading. It does occur though, if the WTemplate
is added later in an event.
I created and added a minimal working example. Just start it up in an ajax enabled session, click the button and enjoy! :)
Files
Updated by Matthias Van Ceulebroeck 9 days ago
- Status changed from New to InProgress
- Assignee set to Matthias Van Ceulebroeck
- Target version set to 4.11.3
Hey Steven,
thank you for the report, it's much appreciated.
While the original was thoroughly tested, it does seem like I missed this case.
Indeed, when rendering a page out initially, or when content is added later on, this will result in different behavior. Since on the initial request we cannot rely on the Wt framework being present already.
Updated by Matthias Van Ceulebroeck 8 days ago
- Status changed from InProgress to Review
- Assignee deleted (
Matthias Van Ceulebroeck)
Updated by Romain Mardulyn 4 days ago
- Status changed from Review to Implemented @Emweb
- Assignee changed from Romain Mardulyn to Matthias Van Ceulebroeck
Updated by Matthias Van Ceulebroeck 4 days ago
- Status changed from Implemented @Emweb to Implemented @Test
Updated by Matthias Van Ceulebroeck 4 days ago
- Status changed from Implemented @Test to Closed