Merge "mediawiki.action.edit.preview: Assorted fixes"
authorTheDJ <hartman.wiki@gmail.com>
Sun, 25 Aug 2013 18:35:08 +0000 (18:35 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 25 Aug 2013 18:35:08 +0000 (18:35 +0000)
resources/Resources.php
resources/mediawiki.action/mediawiki.action.edit.preview.js

index b760b68..e09f2d7 100644 (file)
@@ -743,6 +743,7 @@ return array(
                'dependencies' => array(
                        'jquery.form',
                        'jquery.spinner',
+                       'mediawiki.action.history.diff',
                ),
        ),
        'mediawiki.action.history' => array(
index 0566a87..ca71a99 100644 (file)
@@ -78,8 +78,8 @@
                } );
 
                // Load new preview data.
-               // TODO: This should use the action=parse API instead of loading the entire page
-               // Though that requires figuring out how to convert that raw data into proper HTML.
+               // TODO: This should use the action=parse API instead of loading the entire page,
+               // although that requires figuring out how to convert that raw data into proper HTML.
                $previewDataHolder.load( targetUrl + ' ' + copySelectors.join( ',' ), postData, function () {
                        var i, $from;
                        // Copy the contents of the specified elements from the loaded page to the real page.
                }
 
                // The following elements can change in a preview but are not output
-               // by the server when they're empty until the preview reponse.
+               // by the server when they're empty until the preview response.
                // TODO: Make the server output these always (in a hidden state), so we don't
                // have to fish and (hopefully) put them in the right place (since skins
                // can change where they are output).
 
                if ( !document.getElementById( 'p-lang' ) && document.getElementById( 'p-tb' ) ) {
                        $( '#p-tb' ).after(
-                               $( '<div>' ).prop( 'id', 'p-lang' )
+                               $( '<div>' ).attr( 'id', 'p-lang' )
                        );
                }
 
                if ( !$( '.mw-summary-preview' ).length ) {
                        $( '.editCheckboxes' ).before(
-                               $( '<div>' ).prop( 'className', 'mw-summary-preview' )
+                               $( '<div>' ).addClass( 'mw-summary-preview' )
                        );
                }
 
                if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
                        $( '#wikiPreview' ).after(
-                               $( '<div>' ).prop( 'id', 'wikiDiff')
+                               $( '<div>' ).attr( 'id', 'wikiDiff')
                        );
                }
 
-               // Make sure diff styles are loaded
-               mw.loader.load( 'mediawiki.action.history.diff' );
-
                $( document.body ).on( 'click', '#wpPreview, #wpDiff', doLivePreview );
        } );