mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
Stop checking for SVG support on every hover
https://gerrit.wikimedia.org/r/#/c/121607/3/resources/ext.popups.core.js Bug: 61267 Change-Id: Ibdd5a42c72c43cd797eeb0b3d4c7ba0166e0643d
This commit is contained in:
parent
5617b0f1a0
commit
fbf9bda766
|
@ -15,6 +15,7 @@
|
|||
currentLink, // DOM element of the current anchor tag
|
||||
cache = {},
|
||||
curRequest, // Current API request
|
||||
supportsSVG = document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ),
|
||||
api = new mw.Api(),
|
||||
SIZES = {
|
||||
portraitImage: {
|
||||
|
@ -97,15 +98,6 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method supportsSVG
|
||||
* Checks for SVG support in browser
|
||||
* @return {boolean}
|
||||
*/
|
||||
function supportsSVG() {
|
||||
return document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @method createSVGTag
|
||||
* Use createElementNS to create the svg:image tag as jQuery
|
||||
|
@ -133,7 +125,7 @@
|
|||
var $thumbnail;
|
||||
|
||||
if ( tall ) {
|
||||
if ( supportsSVG() ) {
|
||||
if ( supportsSVG ) {
|
||||
$thumbnail = $( createSVGTag( 'image' ) );
|
||||
$thumbnail
|
||||
.addClass( 'mwe-popups-is-not-tall' )
|
||||
|
@ -161,7 +153,7 @@
|
|||
.css( 'background-image', 'url(' + thumbnail.source + ')' );
|
||||
}
|
||||
} else {
|
||||
if ( supportsSVG() ) {
|
||||
if ( supportsSVG ) {
|
||||
$thumbnail = $( createSVGTag( 'image' ) );
|
||||
$thumbnail
|
||||
.addClass( 'mwe-popups-is-not-tall' )
|
||||
|
@ -497,7 +489,7 @@
|
|||
.appendTo( document.body );
|
||||
|
||||
// SVG for masking and creating the triangle/pokey
|
||||
if ( supportsSVG() ) {
|
||||
if (supportsSVG ) {
|
||||
$svg = $( '<div>' )
|
||||
.attr( 'id', 'mwe-popups-svg' )
|
||||
.appendTo( document.body )
|
||||
|
|
Loading…
Reference in a new issue