mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-09-23 10:25:09 +00:00
Hygiene: Followup from 191fc2a
pass a collection of jQuery objects to `.append` instead of and array. Use `.css` instead of `.attr` to set thumbnail background image. Change a unit to reflect the escaping pattern of the `.css` method Bug: T219846 Change-Id: I6359be2db6c7c7a8e4b52296e0801d4ded921b46
This commit is contained in:
parent
a7e6c196f7
commit
fcd4d1a272
|
@ -49,14 +49,13 @@
|
|||
class: 'ext-related-articles-card'
|
||||
} );
|
||||
|
||||
$listItem.append( [
|
||||
$listItem.append(
|
||||
$( '<div>' )
|
||||
.attr( {
|
||||
class: 'ext-related-articles-card-thumb',
|
||||
style: attributes.hasThumbnail ?
|
||||
'background-image: url( \'' + attributes.thumbnailUrl + '\' );' :
|
||||
null
|
||||
} ),
|
||||
.addClass( 'ext-related-articles-card-thumb' )
|
||||
.css( 'background-image', attributes.hasThumbnail ?
|
||||
'url(' + attributes.thumbnailUrl + ')' :
|
||||
null
|
||||
),
|
||||
$( '<a>' )
|
||||
.attr( {
|
||||
href: attributes.url,
|
||||
|
@ -65,7 +64,7 @@
|
|||
} ),
|
||||
$( '<div>' )
|
||||
.attr( { class: 'ext-related-articles-card-detail' } )
|
||||
.append( [
|
||||
.append(
|
||||
$( '<h3>' ).append(
|
||||
$( '<a>' )
|
||||
.attr( { href: attributes.url } )
|
||||
|
@ -74,8 +73,8 @@
|
|||
$( '<p>' )
|
||||
.attr( { class: 'ext-related-articles-card-extract' } )
|
||||
.text( attributes.extract )
|
||||
] )
|
||||
] );
|
||||
)
|
||||
);
|
||||
|
||||
return $listItem;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
assert.strictEqual(
|
||||
style,
|
||||
'background-image: url( \'http\\:\\/\\/foo\\.bar\\/\\\'\\)\\;display\\:none\\;\\"\\/\\/baz\\.jpg\' );'
|
||||
"background-image: url(\"http://foo.bar/');display:none;\\\"//baz.jpg\");"
|
||||
);
|
||||
} );
|
||||
}() );
|
||||
|
|
Loading…
Reference in a new issue