From fbf9bda766bdb2b1eb6683e43657668f5056a4c2 Mon Sep 17 00:00:00 2001 From: Prateek Saxena Date: Wed, 9 Apr 2014 17:27:29 +0530 Subject: [PATCH] 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 --- resources/ext.popups.core.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js index e945de89c..0ef2ca888 100644 --- a/resources/ext.popups.core.js +++ b/resources/ext.popups.core.js @@ -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 = $( '
' ) .attr( 'id', 'mwe-popups-svg' ) .appendTo( document.body )