]> dev.renevier.net Git - syj.git/blobdiff - public/js/utils.js
fixes: ui is not correctly refreshed after account creation
[syj.git] / public / js / utils.js
index 4c53c76d07cadf7a183b797e52cf8b68f9e5384e..b16a9c2ec4206c1ec83bba7ca38e20f425585a60 100644 (file)
@@ -26,6 +26,9 @@ var CloseBtn = Class.create({
         elt.insert({top: btn});
         btn.observe("click", function(evt) {
             evt.stop();
+            if (evt.detail === 0) { // it's not a real click, possibly a submit event
+                return;
+            }
             if (typeof options.callback === "function") {
                 options.callback.call(elt);
             }
@@ -392,7 +395,7 @@ Element.addMethods('div', {
 
         while (node) {
             nextNode = node.nextSibling;
-            if (node.nodeType === 3 || node.tagName.toLowerCase() === 'br') {
+            if (node.nodeType === 3 || node.tagName.toLowerCase() === 'br' || node.textContent || node.innerText) {
                 div.removeChild(node);
             }
                 node = nextNode;
@@ -405,7 +408,7 @@ Element.addMethods('div', {
         var node = (div.ownerDocument || document).createTextNode(message);
 
         if ($A(div.childNodes).filter(function(node) {
-                return (node.nodeType === 3 || node.tagName.toLowerCase() === 'br');
+                return (node.nodeType === 3 || node.tagName.toLowerCase() === 'br' || node.textContent || node.innerText);
              }).length) {
             div.insert(new Element('br'));
         }