Merge "Update formatting"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.util.js
index 4334a9f..86f06b8 100644 (file)
                 * Get the link to a page name (relative to `wgServer`),
                 *
                 * @param {string} str Page name to get the link for.
-                * @param {Object} params A mapping of query parameter names to values,
-                *     e.g. { action: 'edit' }. Optional.
+                * @param {Object} [params] A mapping of query parameter names to values,
+                *     e.g. `{ action: 'edit' }`.
                 * @return {string} Location for a page with name of `str` or boolean false on error.
                 */
-               wikiGetlink: function ( str, params ) {
+               getUrl: function ( str, params ) {
                        var url = mw.config.get( 'wgArticlePath' ).replace( '$1',
                                util.wikiUrlencode( typeof str === 'string' ? str : mw.config.get( 'wgPageName' ) ) );
                        if ( params && !$.isEmptyObject( params ) ) {
                 */
                addCSS: function ( text ) {
                        var s = mw.loader.addStyleTag( text );
-                       return s.sheet || s;
+                       return s.sheet || s.styleSheet || s;
                },
 
                /**
                                        // nextnode is a DOM element (was the only option before MW 1.17, in wikibits.js)
                                        // or nextnode is a CSS selector for jQuery
                                        nextnode = $ul.find( nextnode );
-                               } else if ( !nextnode.jquery || nextnode[0].parentNode !== $ul[0] ) {
+                               } else if ( !nextnode.jquery || ( nextnode.length && nextnode[0].parentNode !== $ul[0] ) ) {
                                        // Fallback
                                        $ul.append( $item );
                                        return $item[0];
                }
        };
 
+       /**
+        * @method wikiGetlink
+        * @inheritdoc #getUrl
+        * @deprecated since 1.23 Use #getUrl instead.
+        */
+       mw.log.deprecate( util, 'wikiGetlink', util.getUrl, 'Use mw.util.getUrl instead.' );
+
        mw.util = util;
 
 }( mediaWiki, jQuery ) );