Oops, restoring the line I accidently deleted.
authorKaldari <rkaldari@wikimedia.org>
Fri, 9 Nov 2012 02:19:04 +0000 (18:19 -0800)
committerKaldari <rkaldari@wikimedia.org>
Fri, 9 Nov 2012 02:25:10 +0000 (18:25 -0800)
Change-Id: Iefef1881648190c96ac8f6e0b57642018beb3643

resources/jquery/jquery.badge.js

index 3a2a337..9829747 100644 (file)
                        // If a badge already exists, reuse it
                        if ( $badge.length ) {
                                $badge.find( '.mw-badge-content' ).text( text );
+                       } else {
+                               // Otherwise, create a new badge with the specified text and style
+                               div = document.createElement( 'div' );
+                               div.className = 'mw-badge mw-badge-' + ( inline ? 'inline' : 'overlay' );
+                               div.innerHTML = '<span class="mw-badge-content">' + text + '</span>';
+                               $( div ).appendTo( this );
                        }
-                       // Otherwise, create a new badge with the specified text and style
-                       div = document.createElement( 'div' );
-                       div.className = 'mw-badge mw-badge-' + ( inline ? 'inline' : 'overlay' );
-                       div.innerHTML = '<span class="mw-badge-content">' + text + '</span>';
                } else {
                        $badge.remove();
                }