diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index 693c876c3..ef538c952 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -842,13 +842,14 @@ FW_longpoll() var retry; if(filter == "") { $("embed").each(function() { - if($(this.getSVGDocument()).length == 0 && !retry && - filter != ".*" && --embedLoadRetry > 0) { + if(FW_getSVG(this) == undefined && !retry && + filter != ".*" && --embedLoadRetry > 0) { retry = 1; setTimeout(FW_longpoll, 100); return; } - if($(this.getSVGDocument()).find("svg[flog]").attr("flog")) + + if($(FW_getSVG(this)).find("svg[flog]").attr("flog")) filter=".*"; }); if(retry) @@ -1510,9 +1511,19 @@ scriptAttribute(sname) } /*************** SCRIPT LOAD FUNCTIONS END **************/ -function print_call_stack() { +function +print_call_stack() { var stack = new Error().stack; console.log("PRINTING CALL STACK"); console.log( stack ); } +function +FW_getSVG(emb) +{ + if(emb.contentDocument) + return emb.contentDocument; + if(typeof emb.getSVGDocument == "function") + return emb.getSVGDocument(); + return undefined; +} diff --git a/fhem/www/pgm2/svg.js b/fhem/www/pgm2/svg.js index c5803b3a0..ba8a25a00 100644 --- a/fhem/www/pgm2/svg.js +++ b/fhem/www/pgm2/svg.js @@ -350,7 +350,7 @@ svg_init(par) // also called directly from perl, in race condition $("embed").each(function(){ var e = this; var src = $(e).attr("src"); - var ed = e.getSVGDocument(); + var ed = FW_getSVG(e); if(src.indexOf("SVG_showLog") < 0 || !ed) return; var sTag = $("svg", ed)[0]; // "not well-formed" warning in FireFox @@ -380,11 +380,12 @@ FW_svgUpdateDevs(devs) // if matches, refresh the SVG by removing and readding the embed tag var embArr = document.getElementsByTagName("embed"); for(var i = 0; i < embArr.length; i++) { - if(typeof embArr[i].getSVGDocument != "function") - continue; - var svg = embArr[i].getSVGDocument(); + var svg = FW_getSVG(embArr[i]); if(!svg || !svg.firstChild || !svg.firstChild.nextSibling) continue; + if(svg.contentType != "image/svg+xml" && + typeof embArr[i].getSVGDocument != "function") + continue; svg = svg.firstChild.nextSibling; var flog = svg.getAttribute("flog"); if(!flog)