summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortimeless%mozdev.org <>2005-12-19 07:19:54 +0100
committertimeless%mozdev.org <>2005-12-19 07:19:54 +0100
commitdbab0d33fbfe2d0d8abb4bdbcf5393166e2774ee (patch)
tree720884982d330701f9d9f902f906b4818803c9aa
parentdb151383acd906e2174f3e0700c3c57b3aecdab2 (diff)
downloadbugzilla-dbab0d33fbfe2d0d8abb4bdbcf5393166e2774ee.tar.gz
bugzilla-dbab0d33fbfe2d0d8abb4bdbcf5393166e2774ee.tar.xz
Bug 320275 !Node "compat" hack is very broken
r=myk a=justdave
-rw-r--r--template/en/default/bug/dependency-tree.html.tmpl18
-rw-r--r--template/en/default/bug/edit.html.tmpl113
2 files changed, 68 insertions, 63 deletions
diff --git a/template/en/default/bug/dependency-tree.html.tmpl b/template/en/default/bug/dependency-tree.html.tmpl
index b8e0c79e1..8b5ecd59c 100644
--- a/template/en/default/bug/dependency-tree.html.tmpl
+++ b/template/en/default/bug/dependency-tree.html.tmpl
@@ -109,9 +109,11 @@
[% END %]
<script type="text/javascript">
-if (!Node) {
- /* MSIE doesn't define Node, so provide a compatibility array */
- var Node = { TEXT_NODE: 3 };
+if (typeof Node == 'undefined') {
+ /* MSIE doesn't define Node, so provide a compatibility object */
+ window.Node = {
+ TEXT_NODE: 3
+ };
}
function toggleDisplay(node)
@@ -119,7 +121,7 @@ function toggleDisplay(node)
var display = node.style.display;
if (display == "none") {
node.style.display =
- ("oldDisplay" in node) ? node.oldDisplay : "block";
+ ("oldDisplay" in node) ? node.oldDisplay : "block";
return true;
}
@@ -132,18 +134,18 @@ function listToggle(event)
{
var node = event.target;
if (!node)
- node = event.srcElement;
+ node = event.srcElement;
if (node.nodeType == Node.TEXT_NODE)
node = node.parentNode;
var toggle = node.nextSibling;
while (toggle && toggle.tagName != "UL")
- toggle = toggle.nextSibling;
+ toggle = toggle.nextSibling;
if (toggle) {
- node.firstChild.data = toggleDisplay(toggle) ? "[-]" : "[+]";
+ node.firstChild.data = toggleDisplay(toggle) ? "[-]" : "[+]";
}
}
- </script>
+</script>
[% PROCESS global/footer.html.tmpl %]
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 940e320bd..3df301465 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -31,28 +31,30 @@
/* Outputs a link to call replyToComment(); used to reduce HTML output */
function addReplyLink(id) {
- /* XXX this should really be updated to use the DOM Core's
- * createElement, but finding a container isn't trivial */
- document.write('[<a href="#add_comment" onclick="replyToComment(' +
- id + ');">reply<' + '/a>]');
+ /* XXX this should really be updated to use the DOM Core's
+ * createElement, but finding a container isn't trivial.
+ */
+ document.write('[<a href="#add_comment" onclick="replyToComment(' +
+ id + ');">reply<' + '/a>]');
}
/* Adds the reply text to the `comment' textarea */
function replyToComment(id) {
- /* pre id="comment_name_N" */
- var text_elem = document.getElementById('comment_text_'+id);
- var text = getText(text_elem);
-
- /* make sure we split on all newlines -- IE or Moz use \r and \n
- * respectively */
- text = text.split(/\r|\n/);
-
- var replytext = "";
- for (var i=0; i < text.length; i++) {
- replytext += "> " + text[i] + "\n";
- }
+ /* pre id="comment_name_N" */
+ var text_elem = document.getElementById('comment_text_'+id);
+ var text = getText(text_elem);
+
+ /* make sure we split on all newlines -- IE or Moz use \r and \n
+ * respectively.
+ */
+ text = text.split(/\r|\n/);
+
+ var replytext = "";
+ for (var i=0; i < text.length; i++) {
+ replytext += "> " + text[i] + "\n";
+ }
- replytext = "(In reply to comment #" + id + ")\n" + replytext + "\n";
+ replytext = "(In reply to comment #" + id + ")\n" + replytext + "\n";
[% IF Param("insidergroup") && UserInGroup(Param("insidergroup")) %]
if (document.getElementById('isprivate-'+id).checked) {
@@ -60,66 +62,67 @@
}
[% END %]
- /* <textarea id="comment"> */
- var textarea = document.getElementById('comment');
- textarea.value += replytext;
+ /* <textarea id="comment"> */
+ var textarea = document.getElementById('comment');
+ textarea.value += replytext;
- textarea.focus();
+ textarea.focus();
}
- if (!Node) {
- /* MSIE doesn't define Node, so provide a compatibility array */
- var Node = {
- TEXT_NODE: 3,
- ENTITY_REFERENCE_NODE: 5
- };
+ if (typeof Node == 'undefined') {
+ /* MSIE doesn't define Node, so provide a compatibility object */
+ window.Node = {
+ TEXT_NODE: 3,
+ ENTITY_REFERENCE_NODE: 5
+ };
}
/* Concatenates all text from element's childNodes. This is used
* instead of innerHTML because we want the actual text (and
- * innerText is non-standard) */
+ * innerText is non-standard).
+ */
function getText(element) {
- var child, text = "";
- for (var i=0; i < element.childNodes.length; i++) {
- child = element.childNodes[i];
- var type = child.nodeType;
- if (type == Node.TEXT_NODE || type == Node.ENTITY_REFERENCE_NODE) {
- text += child.nodeValue;
- } else {
- /* recurse into nodes of other types */
- text += getText(child);
- }
- }
- return text;
+ var child, text = "";
+ for (var i=0; i < element.childNodes.length; i++) {
+ child = element.childNodes[i];
+ var type = child.nodeType;
+ if (type == Node.TEXT_NODE || type == Node.ENTITY_REFERENCE_NODE) {
+ text += child.nodeValue;
+ } else {
+ /* recurse into nodes of other types */
+ text += getText(child);
+ }
+ }
+ return text;
}
[% IF UserInGroup(Param('timetrackinggroup')) %]
var fRemainingTime = [% bug.remaining_time %]; // holds the original value
function adjustRemainingTime() {
- // subtracts time spent from remaining time
- var new_time;
-
- // prevent negative values if work_time > fRemainingTime
- new_time =
- Math.max(fRemainingTime - document.changeform.work_time.value, 0.0);
- // get upto 2 decimal places
- document.changeform.remaining_time.value =
+ // subtracts time spent from remaining time
+ var new_time;
+
+ // prevent negative values if work_time > fRemainingTime
+ new_time =
+ Math.max(fRemainingTime - document.changeform.work_time.value, 0.0);
+ // get upto 2 decimal places
+ document.changeform.remaining_time.value =
Math.round(new_time * 100)/100;
}
function updateRemainingTime() {
- // if the remaining time is changed manually, update fRemainingTime
- fRemainingTime = document.changeform.remaining_time.value;
+ // if the remaining time is changed manually, update fRemainingTime
+ fRemainingTime = document.changeform.remaining_time.value;
}
[% END %]
function updateCommentTagControl(checkbox, form) {
- if (checkbox.checked) {
- form.comment.className='bz_private';
- } else {
- form.comment.className='';
- }
+ if (checkbox.checked) {
+ form.comment.className='bz_private';
+ } else {
+ form.comment.className='';
+ }
}
//-->