mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Avoid HTML string parsing
Identified using https://github.com/wikimedia/eslint-plugin-jquery/pull/12 Change-Id: I138e018fdc037d688e055eacddfdc5bfc2cc5abe
This commit is contained in:
parent
1a3e8a958c
commit
f2a9ccd5bd
|
@ -77,7 +77,7 @@ ve.ce.MWExtensionNode.prototype.generateContents = function ( config ) {
|
||||||
.fail( this.onParseError.bind( this, deferred ) );
|
.fail( this.onParseError.bind( this, deferred ) );
|
||||||
return deferred.promise( { abort: xhr.abort } );
|
return deferred.promise( { abort: xhr.abort } );
|
||||||
} else {
|
} else {
|
||||||
deferred.resolve( $( '<span> </span>' ).get() );
|
deferred.resolve( $( '<span>' ).text( '\u00a0' ).get() );
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2644,7 +2644,7 @@ ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems )
|
||||||
} ) );
|
} ) );
|
||||||
} );
|
} );
|
||||||
return $.when.apply( $, promises ).then( function () {
|
return $.when.apply( $, promises ).then( function () {
|
||||||
var $output = $( '<div class="catlinks" />' );
|
var $output = $( '<div>' ).addClass( 'catlinks' );
|
||||||
function renderPageLink( page ) {
|
function renderPageLink( page ) {
|
||||||
var title = mw.Title.newFromText( page.category || page );
|
var title = mw.Title.newFromText( page.category || page );
|
||||||
return $( '<a>' ).attr( 'rel', 'mw:WikiLink' ).attr( 'href', title.getUrl() ).text( title.getMainText() );
|
return $( '<a>' ).attr( 'rel', 'mw:WikiLink' ).attr( 'href', title.getUrl() ).text( title.getMainText() );
|
||||||
|
@ -2661,7 +2661,7 @@ ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems )
|
||||||
}
|
}
|
||||||
if ( categories.normal.length ) {
|
if ( categories.normal.length ) {
|
||||||
categories.normal.sort( categorySort );
|
categories.normal.sort( categorySort );
|
||||||
$normal = $( '<div class="mw-normal-catlinks" />' );
|
$normal = $( '<div>' ).addClass( 'mw-normal-catlinks' );
|
||||||
$normal.append(
|
$normal.append(
|
||||||
renderPageLink( ve.msg( 'pagecategorieslink' ) ).text( ve.msg( 'pagecategories', categories.normal.length ) ),
|
renderPageLink( ve.msg( 'pagecategorieslink' ) ).text( ve.msg( 'pagecategories', categories.normal.length ) ),
|
||||||
ve.msg( 'colon-separator' ),
|
ve.msg( 'colon-separator' ),
|
||||||
|
@ -2671,7 +2671,7 @@ ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems )
|
||||||
}
|
}
|
||||||
if ( categories.hidden.length ) {
|
if ( categories.hidden.length ) {
|
||||||
categories.hidden.sort( categorySort );
|
categories.hidden.sort( categorySort );
|
||||||
$hidden = $( '<div class="mw-hidden-catlinks" />' );
|
$hidden = $( '<div>' ).addClass( 'mw-hidden-catlinks' );
|
||||||
if ( mw.user.options.get( 'showhiddencats' ) ) {
|
if ( mw.user.options.get( 'showhiddencats' ) ) {
|
||||||
$hidden.addClass( 'mw-hidden-cats-user-shown' );
|
$hidden.addClass( 'mw-hidden-cats-user-shown' );
|
||||||
} else if ( mw.config.get( 'wgNamespaceIds' ).category === mw.config.get( 'wgNamespaceNumber' ) ) {
|
} else if ( mw.config.get( 'wgNamespaceIds' ).category === mw.config.get( 'wgNamespaceNumber' ) ) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ ve.ui.MWLanguageVariantNodeContextItem.prototype.setup = function () {
|
||||||
ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () {
|
ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () {
|
||||||
var $body = this.$body,
|
var $body = this.$body,
|
||||||
$table = $( '<table>' ),
|
$table = $( '<table>' ),
|
||||||
$header = $( '<tr> ' ),
|
$header = $( '<tr>' ),
|
||||||
variantInfo = this.model.getVariantInfo(),
|
variantInfo = this.model.getVariantInfo(),
|
||||||
type = this.model.getRuleType(),
|
type = this.model.getRuleType(),
|
||||||
isHidden = this.model.isHidden(),
|
isHidden = this.model.isHidden(),
|
||||||
|
|
Loading…
Reference in a new issue