X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=public%2Fjs%2Futils.js;h=d59a112736ce89d77e79b00c78b9de699c3f7e4c;hp=588a85b590e2af6303225f47b478b7c62ce1837f;hb=429ae1e23517d82c022fc66df26b05c9da7f8b5e;hpb=56542f930c6a4d6f48a405a17561d436e1d8f9b9 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(); },