(bug 14328) - Allow DOM objects to be used in jsMsg(), not only strings.
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 12 Jun 2008 14:01:05 +0000 (14:01 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 12 Jun 2008 14:01:05 +0000 (14:01 +0000)
RELEASE-NOTES
skins/common/wikibits.js

index 910dc9d..25eea69 100644 (file)
@@ -154,6 +154,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add a new hook LinkerMakeExternalLink to allow extensions to modify the output of
   external links.
 * (bug 14132) Allow user to disable bot edits from being output to UDP. 
+* (bug 14328) jsMsg() within Wikibits now accepts a DOM object, not just a string  
   
 === Bug fixes in 1.13 ===
 
index 802b595..72f0996 100644 (file)
@@ -772,7 +772,7 @@ function ts_alternate(table) {
  * Add a cute little box at the top of the screen to inform the user of
  * something, replacing any preexisting message.
  *
- * @param String message HTML to be put inside the right div
+ * @param String -or- Dom Object message HTML to be put inside the right div
  * @param String className   Used in adding a class; should be different for each
  *   call to allow CSS/JS to hide different boxes.  null = no class used.
  * @return Boolean       True on success, false on failure
@@ -811,6 +811,15 @@ function jsMsg( message, className ) {
                messageDiv.setAttribute( 'class', 'mw-js-message-'+className );
        }
        messageDiv.innerHTML = message;
+       
+       if (typeof message == 'string') {
+               messageDiv.innerHTML = message;
+       }
+       else if (typeof message == 'object') {
+               while (messageDiv.hasChildNodes()) // Remove old content
+                       messageDiv.removeChild(messageDiv.firstChild);
+               messageDiv.appendChild (message); // Append new content
+       }
        return true;
 }