buildHtml: function () {
var $container, $bits, panes, id, gitInfo;
- $container = $( '<div id="mw-debug-toolbar" class="mw-debug" lang="en" dir="ltr"></div>' );
+ $container = $( '<div>' )
+ .attr( {
+ id: 'mw-debug-toolbar',
+ lang: 'en',
+ dir: 'ltr'
+ } )
+ .addClass( 'mw-debug' );
- $bits = $( '<div class="mw-debug-bits"></div>' );
+ $bits = $( '<div>' ).addClass( 'mw-debug-bits' );
/**
* Returns a jQuery element for a debug-bit div
}
bitDiv( 'mwversion' )
- .append( $( '<a href="//www.mediawiki.org/">MediaWiki</a>' ) )
+ .append( $( '<a>' ).attr( 'href', '//www.mediawiki.org/' ).text( 'MediaWiki' ) )
.append( document.createTextNode( ': ' + this.data.mwVersion + ' ' ) )
.append( gitInfo );
}
bitDiv( 'phpversion' )
- .append( $( this.data.phpEngine === 'HHVM' ?
- '<a href="https://hhvm.com/">HHVM</a>' :
- '<a href="https://php.net/">PHP</a>'
- ) )
+ .append( this.data.phpEngine === 'HHVM' ?
+ $( '<a>' ).attr( 'href', 'https://hhvm.com/' ).text( 'HHVM' ) :
+ $( '<a>' ).attr( 'href', 'https://php.net/' ).text( 'PHP' )
+ )
.append( ': ' + this.data.phpVersion );
bitDiv( 'time' )
buildConsoleTable: function () {
var $table, entryTypeText, i, length, entry;
- $table = $( '<table id="mw-debug-console">' );
+ $table = $( '<table>' ).attr( 'id', 'mw-debug-console' );
$( '<colgroup>' ).css( 'width', /* padding = */ 20 + ( 10 * /* fontSize = */ 11 ) ).appendTo( $table );
$( '<colgroup>' ).appendTo( $table );
buildQueryTable: function () {
var $table, i, length, query;
- $table = $( '<table id="mw-debug-querylist"></table>' );
+ $table = $( '<table>' ).attr( 'id', 'mw-debug-querylist' );
$( '<tr>' )
- .append( $( '<th>#</th>' ).css( 'width', '4em' ) )
- .append( $( '<th>SQL</th>' ) )
- .append( $( '<th>Time</th>' ).css( 'width', '8em' ) )
- .append( $( '<th>Call</th>' ).css( 'width', '18em' ) )
+ .append( $( '<th>' ).text( '#' ).css( 'width', '4em' ) )
+ .append( $( '<th>' ).text( 'SQL' ) )
+ .append( $( '<th>' ).text( 'Time' ).css( 'width', '8em' ) )
+ .append( $( '<th>' ).text( 'Call' ).css( 'width', '18em' ) )
.appendTo( $table );
for ( i = 0, length = this.data.queries.length; i < length; i += 1 ) {
$( '<tr>' )
.append( $( '<td>' ).text( i + 1 ) )
.append( $( '<td>' ).text( query.sql ) )
- .append( $( '<td class="stats">' ).text( ( query.time * 1000 ).toFixed( 4 ) + 'ms' ) )
+ .append( $( '<td>' ).text( ( query.time * 1000 ).toFixed( 4 ) + 'ms' ).addClass( 'stats' ) )
.append( $( '<td>' ).text( query[ 'function' ] ) )
.appendTo( $table );
}
file = this.data.includes[ i ];
$( '<tr>' )
.append( $( '<td>' ).text( file.name ) )
- .append( $( '<td class="nr">' ).text( file.size ) )
+ .append( $( '<td>' ).text( file.size ).addClass( 'nr' ) )
.appendTo( $table );
}
function Notification( message, options ) {
var $notification, $notificationContent;
- $notification = $( '<div class="mw-notification"></div>' )
+ $notification = $( '<div>' )
.data( 'mw-notification', this )
- .addClass( options.autoHide ? 'mw-notification-autohide' : 'mw-notification-noautohide' );
+ .addClass( [
+ 'mw-notification',
+ options.autoHide ? 'mw-notification-autohide' : 'mw-notification-noautohide'
+ ] );
if ( options.tag ) {
// Sanitize options.tag before it is used by any code. (Including Notification class methods)
}
if ( options.title ) {
- $( '<div class="mw-notification-title"></div>' )
+ $( '<div>' )
+ .addClass( 'mw-notification-title' )
.text( options.title )
.appendTo( $notification );
}
- $notificationContent = $( '<div class="mw-notification-content"></div>' );
+ $notificationContent = $( '<div>' ).addClass( 'mw-notification-content' );
if ( typeof message === 'object' ) {
// Handle mw.Message objects separately from DOM nodes and jQuery objects