Xavier (Open ERP) has proposed merging
lp:~openerp-dev/openerp-web/trunk-msie8-fixes-xmo into lp:openerp-web.
Requested reviews:
OpenERP R&D Web Team (openerp-dev-web)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-msie8-fixes-xmo/+merge/89018
There's a potential issue left with dynamic types (t-att-type), password form
fields should be checked because listview's checkbox/radio completely blew up.
Fixes a bunch of stuff, mostly in qweb:
* In IE, converts XML documents to HTML so jQuery can correctly do its thing.
The conversion is manual (the tree is traversed and replicated using
createElement & stuff). Conversion uses a recursive function, so may blow up
for deep trees.
* Add a bunch of toLowerCase() stuff in order to fix qweb tests in IE8
* Note that IE throws out text nodes composed only of whitespace,
@xml:space="preserve" is required to ensure it's not broken
* Fixed a few places where there was a text node in iframe (IE8 does not like
.appendChild on iframe elements)
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-msie8-fixes-xmo/+merge/89018
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-msie8-fixes-xmo.
=== modified file 'addons/web/static/lib/qweb/qweb-test-extend.xml'
--- addons/web/static/lib/qweb/qweb-test-extend.xml 2011-05-09 12:19:01 +0000
+++ addons/web/static/lib/qweb/qweb-test-extend.xml 2012-01-18 12:38:26 +0000
@@ -22,11 +22,11 @@
<t t-jquery="hr:eq(1)" t-operation="replace"><footer></footer></t>
</t>
<t t-extend="jquery-extend">
- <t t-jquery="footer" t-operation="inner"><b>END</b></t>
+ <t t-jquery="footer" t-operation="inner"><b>[[end]]</b></t>
</t>
<t t-name="jquery-extend-clone" t-extend="jquery-extend">
- <t t-jquery="ul" t-operation="append"><li>CLONED TEMPLATE</li></t>
+ <t t-jquery="ul" t-operation="append"><li>[[cloned template]]</li></t>
</t>
</templates>
=== modified file 'addons/web/static/lib/qweb/qweb-test-foreach.xml'
--- addons/web/static/lib/qweb/qweb-test-foreach.xml 2011-05-04 10:09:08 +0000
+++ addons/web/static/lib/qweb/qweb-test-foreach.xml 2012-01-18 12:38:26 +0000
@@ -1,4 +1,4 @@
-<templates>
+<templates xml:space="preserve">
<t t-name="repetition-text-content" t-foreach="seq">*</t>
<t t-name="repetition-dom-content" t-foreach="seq"><b/></t>
<b t-name="repetition-self" t-foreach="seq"/>
=== modified file 'addons/web/static/lib/qweb/qweb-test.js.html'
--- addons/web/static/lib/qweb/qweb-test.js.html 2011-05-09 12:19:01 +0000
+++ addons/web/static/lib/qweb/qweb-test.js.html 2012-01-18 12:38:26 +0000
@@ -5,7 +5,6 @@
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen"/>
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
- <script type="text/javascript" src="/base/static/lib/jquery/jquery-1.5.2.js"></script>
<script type="text/javascript" src="qweb2.js"></script>
<script>
@@ -14,7 +13,7 @@
return s.replace(/(^\s+|\s+$)/g, '');
}
function render(template, context) {
- return trim(QWeb.render(template, context));
+ return trim(QWeb.render(template, context)).toLowerCase();
}
$(document).ready(function() {
module("Basic output tests", {
@@ -209,9 +208,9 @@
test('Basic foreach repetition', function () {
equals(QWeb.render('repetition-text-content', {seq:seq}), '*****',
"Repetition of text content via foreach");
- equals(QWeb.render('repetition-dom-content', {seq:seq}), '<b/><b/><b/><b/><b/>',
+ equals(QWeb.render('repetition-dom-content', {seq:seq}).toLowerCase(), '<b/><b/><b/><b/><b/>',
"Repetition of node content via foreach");
- equals(QWeb.render('repetition-self', {seq:seq}), '<b/><b/><b/><b/><b/>',
+ equals(QWeb.render('repetition-self', {seq:seq}).toLowerCase(), '<b/><b/><b/><b/><b/>',
"A node with a foreach repeats itself");
});
test("Foreach scope content", function () {
@@ -249,9 +248,9 @@
});
test("jQuery extend", function () {
- equals(render('jquery-extend', {}), '<hr/><ul class="main"><li>1</li><li>2</li><li>3</li></ul><footer><b>END</b></footer>',
+ equals(render('jquery-extend', {}), '<hr/><ul class="main"><li>1</li><li>2</li><li>3</li></ul><footer><b>[[end]]</b></footer>',
"Extend template with jQuery");
- equals(render('jquery-extend-clone', {}), '<ul><li>one</li><li>CLONED TEMPLATE</li></ul>',
+ equals(render('jquery-extend-clone', {}), '<ul><li>one</li><li>[[cloned template]]</li></ul>',
"Clone template");
});
});
=== modified file 'addons/web/static/lib/qweb/qweb2.js'
--- addons/web/static/lib/qweb/qweb2.js 2012-01-17 21:59:49 +0000
+++ addons/web/static/lib/qweb/qweb2.js 2012-01-18 12:38:26 +0000
@@ -93,10 +93,16 @@
}
return r.join('');
} else {
- if (node.xml !== undefined) {
- return node.xml;
- } else {
+ if (typeof XMLSerializer !== 'undefined') {
return (new XMLSerializer()).serializeToString(node);
+ } else {
+ switch(node.nodeType) {
+ case 1: return node.outerHTML;
+ case 3: return node.data;
+ case 4: return '<![CDATA[' + node.data + ']]>';
+ case 8: return '<!-- ' + node.data + '-->';
+ }
+ throw new Error('Unknown node type ' + node.nodeType);
}
}
},
@@ -265,11 +271,16 @@
}
req.open('GET', s, false);
req.send(null);
- if (req.responseXML) {
- if (req.responseXML.documentElement.nodeName == "parsererror") {
- return this.tools.exception(req.responseXML.documentElement.childNodes[0].nodeValue);
- }
- return req.responseXML;
+ var xDoc = req.responseXML;
+ if (xDoc) {
+ if (xDoc.documentElement.nodeName == "parsererror") {
+ return this.tools.exception(xDoc.documentElement.childNodes[0].nodeValue);
+ }
+ if (xDoc.xml !== undefined) {
+ // MSIE
+ return this.convert_xml_to_html(xDoc.documentElement);
+ }
+ return xDoc;
} else {
return this.load_xml_string(req.responseText);
}
@@ -295,7 +306,25 @@
xDoc.async = false;
xDoc.preserveWhiteSpace = true;
xDoc.loadXML(s);
- return xDoc;
+ return this.convert_xml_to_html(xDoc.documentElement);
+ },
+ convert_xml_to_html: function (node) {
+ switch (node.nodeType) {
+ case 3:
+ case 4:
+ return document.createTextNode(node.data);
+ case 8: return document.createComment(node.data);
+ }
+
+ var hnode = document.createElement(node.nodeName);
+ for(var i=0, alen=node.attributes.length; i < alen; ++i) {
+ var attr = node.attributes[i];
+ hnode.setAttribute(attr.name, attr.value);
+ }
+ for(var j=0, clen=node.childNodes.length; j < clen; ++j) {
+ hnode.appendChild(this.convert_xml_to_html(node.childNodes[j]));
+ }
+ return hnode;
},
has_template : function(template) {
return !!this.templates[template];
@@ -373,12 +402,7 @@
if (!this.jQuery) {
return this.tools.exception("Can't extend template " + template + " without jQuery");
}
- var template_dest = this.templates[template],
- msie_trololo = false;
- if (template_dest.xml !== undefined) {
- template_dest = this.jQuery(template_dest.xml);
- msie_trololo = true;
- }
+ var template_dest = this.templates[template];
for (var i = 0, ilen = extend_node.childNodes.length; i < ilen; i++) {
var child = extend_node.childNodes[i];
if (child.nodeType === 1) {
@@ -421,9 +445,6 @@
}
}
}
- if (msie_trololo) {
- this.templates[template] = template_dest[0];
- }
}
});
return Engine;
=== modified file 'addons/web/static/src/xml/base.xml'
--- addons/web/static/src/xml/base.xml 2012-01-17 12:00:35 +0000
+++ addons/web/static/src/xml/base.xml 2012-01-18 12:38:26 +0000
@@ -682,7 +682,9 @@
</td>
</t>
<th t-if="options.selectable" class="oe-record-selector" width="1">
- <input t-att-type="options.radio? 'radio': 'checkbox'" name ="radiogroup" t-att-checked="options.select_view_id == record.get('id')? true: null"/>
+ <t t-set="checked" t-value="options.select_view_id == record.get('id') ? 'checked' : null"/>
+ <input t-if="options.radio" type="radio" name="radiogroup" t-att-checked="checked"/>
+ <input t-if="!options.radio" type="checkbox" name="radiogroup" t-att-checked="checked"/>
</th>
<th t-if="options.isClarkGable" class="oe-record-edit-link" width="1">
<img src="/web/static/src/img/pencil.gif" width="12" height="12" class="oe-record-edit-link-img"/>
@@ -747,7 +749,7 @@
<input type="file" class="oe-binary-file" name="ufile" title="Add attachment"
t-att-onclick="view.datarecord.id ? null : 'alert(\'No record selected ! You can only attach to existing record.\'); return false;'"/>
</form>
- <iframe t-attf-id="#{element_id}_iframe" t-attf-name="#{element_id}_iframe" style="display: none"> </iframe>
+ <iframe t-attf-id="#{element_id}_iframe" t-attf-name="#{element_id}_iframe" style="display: none"/>
</div>
</div>
<br style="clear: both"/>
@@ -1084,7 +1086,7 @@
<img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16"/>
<b>Uploading ...</b>
</div>
- <iframe t-att-id="widget.iframe" t-att-name="widget.iframe" style="display: none"> </iframe>
+ <iframe t-att-id="widget.iframe" t-att-name="widget.iframe" style="display: none"/>
</td>
</tr>
</table>
@@ -1134,7 +1136,7 @@
<td class="oe-binary-progress" style="display: none" nowrap="true">
<img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16"/>
<b>Uploading ...</b>
- <iframe t-att-id="widget.iframe" t-att-name="widget.iframe" style="display: none"> </iframe>
+ <iframe t-att-id="widget.iframe" t-att-name="widget.iframe" style="display: none"/>
</td>
</tr>
</table>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp