forked from odoo/owl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] component: allow using vars with body as props
Consider this scenario: - a variable v (with a body) is defined in a template - it is then passed to a sub component as a prop - and now, it is t-esc-ed. Before this commit, the displayed value was [object object], because the value actually passed to the sub component was a VDomArray (internal structure used to represent nodelists) This issue is actually quite a problem in practice, because values in a templates are translated, but not in attributes. Therefore, using a t-set directive with a body text content is the proper way to have translated values at runtime. We override in this commit the method toString of VDomArray to make sure it is properly displayed. Note that we considered changing the way props were generated (by trying to detect VDomArray, then calling vDomToString), but then the value would not be able to be used in a t-raw. Also, it is quite elegant to be able to format the VDomArray only at the end. closes odoo#670
- Loading branch information
Showing
3 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters