Commit dbab0d33 authored by timeless%mozdev.org's avatar timeless%mozdev.org

Bug 320275 !Node "compat" hack is very broken

r=myk a=justdave
parent db151383
...@@ -109,9 +109,11 @@ ...@@ -109,9 +109,11 @@
[% END %] [% END %]
<script type="text/javascript"> <script type="text/javascript">
if (!Node) { if (typeof Node == 'undefined') {
/* MSIE doesn't define Node, so provide a compatibility array */ /* MSIE doesn't define Node, so provide a compatibility object */
var Node = { TEXT_NODE: 3 }; window.Node = {
TEXT_NODE: 3
};
} }
function toggleDisplay(node) function toggleDisplay(node)
...@@ -143,7 +145,7 @@ function listToggle(event) ...@@ -143,7 +145,7 @@ function listToggle(event)
} }
} }
</script> </script>
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
/* Outputs a link to call replyToComment(); used to reduce HTML output */ /* Outputs a link to call replyToComment(); used to reduce HTML output */
function addReplyLink(id) { function addReplyLink(id) {
/* XXX this should really be updated to use the DOM Core's /* XXX this should really be updated to use the DOM Core's
* createElement, but finding a container isn't trivial */ * createElement, but finding a container isn't trivial.
*/
document.write('[<a href="#add_comment" onclick="replyToComment(' + document.write('[<a href="#add_comment" onclick="replyToComment(' +
id + ');">reply<' + '/a>]'); id + ');">reply<' + '/a>]');
} }
...@@ -44,7 +45,8 @@ ...@@ -44,7 +45,8 @@
var text = getText(text_elem); var text = getText(text_elem);
/* make sure we split on all newlines -- IE or Moz use \r and \n /* make sure we split on all newlines -- IE or Moz use \r and \n
* respectively */ * respectively.
*/
text = text.split(/\r|\n/); text = text.split(/\r|\n/);
var replytext = ""; var replytext = "";
...@@ -67,9 +69,9 @@ ...@@ -67,9 +69,9 @@
textarea.focus(); textarea.focus();
} }
if (!Node) { if (typeof Node == 'undefined') {
/* MSIE doesn't define Node, so provide a compatibility array */ /* MSIE doesn't define Node, so provide a compatibility object */
var Node = { window.Node = {
TEXT_NODE: 3, TEXT_NODE: 3,
ENTITY_REFERENCE_NODE: 5 ENTITY_REFERENCE_NODE: 5
}; };
...@@ -77,7 +79,8 @@ ...@@ -77,7 +79,8 @@
/* Concatenates all text from element's childNodes. This is used /* Concatenates all text from element's childNodes. This is used
* instead of innerHTML because we want the actual text (and * instead of innerHTML because we want the actual text (and
* innerText is non-standard) */ * innerText is non-standard).
*/
function getText(element) { function getText(element) {
var child, text = ""; var child, text = "";
for (var i=0; i < element.childNodes.length; i++) { for (var i=0; i < element.childNodes.length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment