diff options
author | David Lawrence <dlawrence@mozilla.com> | 2011-09-01 14:30:51 -0400 |
---|---|---|
committer | David Lawrence <dlawrence@mozilla.com> | 2011-09-01 14:30:51 -0400 |
commit | 4055a481342339a5665df5b2ddb2f6843c66c368 (patch) | |
tree | 02d02a97239900e4a13dd0a6226bed5fecd94586 /js | |
parent | af9cc0424a7fb08b95de7de7e8e978cfd777865a (diff) | |
download | bugs-4055a481342339a5665df5b2ddb2f6843c66c368.tar bugs-4055a481342339a5665df5b2ddb2f6843c66c368.tar.gz bugs-4055a481342339a5665df5b2ddb2f6843c66c368.tar.bz2 bugs-4055a481342339a5665df5b2ddb2f6843c66c368.tar.xz bugs-4055a481342339a5665df5b2ddb2f6843c66c368.zip |
Bug 653634 - Change the comment reply header to include the name of the person who has commented
r/a=LpSolit
Diffstat (limited to 'js')
-rw-r--r-- | js/comments.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/comments.js b/js/comments.js index f46499b62..28ef54397 100644 --- a/js/comments.js +++ b/js/comments.js @@ -145,3 +145,30 @@ function goto_add_comments( anchor ){ },10); return false; } + +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). + */ +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; +} |