Commit 1db177ad by Josh McLaughlin

Fix: background image issue prevents block from loading in IE11

Image.height and Image.width returns 0 for SVGs loaded in JavaScript on
IE11, this uses a klunky workaround to get the height and width
parent 621c7ba2
......@@ -978,6 +978,14 @@ function DragAndDropBlock(runtime, element, configuration) {
var promise = $.Deferred();
var img = new Image();
img.addEventListener("load", function() {
if (img.width == 0 || img.height == 0) {
// Workaround for IE11 issue with SVG images
document.body.appendChild(img);
var width = img.offsetWidth;
var height = img.offsetHeight;
document.body.removeChild(img);
img.width = width, img.height = height;
}
if (img.width > 0 && img.height > 0) {
promise.resolve(img);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment