diff options
| author | Simon Lejeune <sle@openerp.com> | 2014-12-15 14:16:10 +0100 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2014-12-19 17:49:13 +0100 |
| commit | 01409c1d7b0050942ba5e53ff4f3bb927fd3eb51 (patch) | |
| tree | 7d1807ae1b022e1ec4c89a0e80c0f7f469b74938 /addons/web/static/src/xml | |
| parent | b291f9f4c6508bdc75c3e111f9c6c4838d7db38f (diff) | |
[FIX] web: openerpframework: replaceElement on multiple roots nodeset
jquery's `replaceWith` function behaves differently between 1.8 and 1.9.
This function is used by `renderElement` of the Odoo widget API and, when
called on a template with multiple root nodes, will fail to replace the
whole original nodeset by the new but instead will replace every node
by the new nodeset.
Sample:
1) Suppose a DOM containing
<div>1</div>
<div>2</div>
and a jquery nodeset [<div>1</div>, <div>2</div>] referring to the
previous DOM part in a var named $oldel.;
2) suppose another jquery nodeset [<div>3</div>, <div>4</div>] in $el;
$oldel.replaceWith($el) will result in
"3434" in jquery 1.9.1
"34" in jquery 1.8.3
This issue particulary concerns us when the dom of a widget is not wrapped
into single tag and when re-calling renderElement (triggering replaceElement).
The fix is to wrap the element to be replaced ($oldel in the example) behind
a div before calling replaceWith.
Diffstat (limited to 'addons/web/static/src/xml')
0 files changed, 0 insertions, 0 deletions
