From: arno Date: Sat, 14 Aug 2010 21:39:16 +0000 (+0200) Subject: fixes incompatibility between div messenger and closebtn X-Git-Tag: v0.2~55 X-Git-Url: https://dev.renevier.net/?p=syj.git;a=commitdiff_plain;h=429ae1e23517d82c022fc66df26b05c9da7f8b5e fixes incompatibility between div messenger and closebtn --- diff --git a/public/js/utils.js b/public/js/utils.js index 588a85b..d59a112 100644 --- a/public/js/utils.js +++ b/public/js/utils.js @@ -311,9 +311,13 @@ Element.addMethods('div', { addMessage: function(div, message) { var node = (div.ownerDocument || document).createTextNode(message); - if (!div.empty()) { + + if ($A(div.childNodes).filter(function(node) { + return (node.nodeType === 3 || node.tagName.toLowerCase() === 'br'); + }).length) { div.insert(new Element('br')); } + div.appendChild(node); return div.show(); },