[FIX] Do not self close empty elements that are not html void elements
bzr revid: fme@openerp.com-20140507162903-1s2rmlvawohlxvc0
This commit is contained in:
commit
8e29e128eb
|
@ -29,7 +29,7 @@
|
||||||
<div t-if="testing || true" t-att-class="novar || 'yes'" style="display: none">
|
<div t-if="testing || true" t-att-class="novar || 'yes'" style="display: none">
|
||||||
<t t-set="novar"></t>
|
<t t-set="novar"></t>
|
||||||
<t t-set="style">height: 200px; border: 1px solid red;</t>
|
<t t-set="style">height: 200px; border: 1px solid red;</t>
|
||||||
<div t-att="{ 'style' : style, 'disabled' : 'false', 'readonly' : novar or undefined }" t-opentag="true"/>
|
<div t-att="{ 'style' : style, 'disabled' : 'false', 'readonly' : novar or undefined }"/>
|
||||||
<t t-foreach="{'my': 'first', 'my2': 'second' }" t-as="v">
|
<t t-foreach="{'my': 'first', 'my2': 'second' }" t-as="v">
|
||||||
* <t t-esc="v"/> : <t t-esc="v_value"/>
|
* <t t-esc="v"/> : <t t-esc="v_value"/>
|
||||||
</t>
|
</t>
|
||||||
|
|
|
@ -37,6 +37,7 @@ var QWeb2 = {
|
||||||
'lt': '<',
|
'lt': '<',
|
||||||
'lte': '<='
|
'lte': '<='
|
||||||
},
|
},
|
||||||
|
VOID_ELEMENTS: 'area,base,br,col,embed,hr,img,input,keygen,link,menuitem,meta,param,source,track,wbr'.split(','),
|
||||||
tools: {
|
tools: {
|
||||||
exception: function(message, context) {
|
exception: function(message, context) {
|
||||||
context = context || {};
|
context = context || {};
|
||||||
|
@ -218,6 +219,7 @@ QWeb2.Engine = (function() {
|
||||||
this.jQuery = window.jQuery;
|
this.jQuery = window.jQuery;
|
||||||
this.reserved_words = QWeb2.RESERVED_WORDS.slice(0);
|
this.reserved_words = QWeb2.RESERVED_WORDS.slice(0);
|
||||||
this.actions_precedence = QWeb2.ACTIONS_PRECEDENCE.slice(0);
|
this.actions_precedence = QWeb2.ACTIONS_PRECEDENCE.slice(0);
|
||||||
|
this.void_elements = QWeb2.VOID_ELEMENTS.slice(0);
|
||||||
this.word_replacement = QWeb2.tools.extend({}, QWeb2.WORD_REPLACEMENT);
|
this.word_replacement = QWeb2.tools.extend({}, QWeb2.WORD_REPLACEMENT);
|
||||||
this.preprocess_node = null;
|
this.preprocess_node = null;
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
@ -480,6 +482,7 @@ QWeb2.Element = (function() {
|
||||||
this._bottom = [];
|
this._bottom = [];
|
||||||
this._indent = 1;
|
this._indent = 1;
|
||||||
this.process_children = true;
|
this.process_children = true;
|
||||||
|
this.is_void_element = ~QWeb2.tools.arrayIndexOf(this.engine.void_elements, this.tag);
|
||||||
var childs = this.node.childNodes;
|
var childs = this.node.childNodes;
|
||||||
if (childs) {
|
if (childs) {
|
||||||
for (var i = 0, ilen = childs.length; i < ilen; i++) {
|
for (var i = 0, ilen = childs.length; i < ilen; i++) {
|
||||||
|
@ -677,11 +680,13 @@ QWeb2.Element = (function() {
|
||||||
this.top("r.push(context.engine.tools.gen_attribute(['" + m[1] + "', (" + (this.string_interpolation(v)) + ")]));");
|
this.top("r.push(context.engine.tools.gen_attribute(['" + m[1] + "', (" + (this.string_interpolation(v)) + ")]));");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.children.length || this.actions.opentag === 'true') {
|
if (this.actions.opentag === 'true' || (!this.children.length && this.is_void_element)) {
|
||||||
|
// We do not enforce empty content on void elements
|
||||||
|
// because QWeb rendering is not necessarily html.
|
||||||
|
this.top_string("/>");
|
||||||
|
} else {
|
||||||
this.top_string(">");
|
this.top_string(">");
|
||||||
this.bottom_string("</" + this.tag + ">");
|
this.bottom_string("</" + this.tag + ">");
|
||||||
} else {
|
|
||||||
this.top_string("/>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -496,7 +496,7 @@
|
||||||
</h2>
|
</h2>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="oe_view_manager_view_search" t-opentag="true"/>
|
<div class="oe_view_manager_view_search"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="oe_header_row">
|
<tr class="oe_header_row">
|
||||||
|
|
Loading…
Reference in New Issue