chunhaicao / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

IE7 getElementsByTagNameNS not supported #638

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Following code snippet works correctly on IE8, but throws error on IE7 
whenever referencing getElementsByTagNameNS
2.
3.

What is the expected output? What do you see instead?
Console Error: Object doesn't support property or method 
'getElementsByTagNameNS'

What version of the product are you using? On what operating system,
browser, and version of Flash?
svgweb-2011-02-03-Lurker-Above using IE9, Win2008 server, Flash version is WIN 
10,3,162,28

Please provide any additional information below. Reduced test cases are
always appreciated!

//Received svgonload event, now setup our globals
if (window.svgweb) {
   // get a new reference to the SVG OBJECT after its been transformed
   var svgObjId = evt.target._handler.id;
   var currSVGObject = document.getElementById(svgObjId);
   gSVGDOMDoc = currSVGObject.contentDocument;
   if (!gSVGDOMDoc) {
      console.error("_SVG:documentLoad: contentDocument undefined")
      return;
   }
   //getElementsByTagNameNS is defined but still throws error in IE7
   //gSVGXMLRoot=gSVGDOMDoc.getElementsByTagNameNS(svgns,'svg')[0];
   gSVGXMLRoot = gSVGDOMDoc.rootElement;
/************DEBUGMODE*****************
Test getElementsByTagNameNS
*************DEBUGMODE****************/
   try {
      //next line throws error in IE7
      var textElems = gSVGDOMDoc.getElementsByTagNameNS(svgns, 'text');
      for (var i = 0; i < textElems.length; i++) {
         console.log("SVG:Test TextNodes " + i + ": " + textElems[i].childNodes[0].nodeValue);
      }
   } catch (e) {
      console.error("_SVG:documentLoad", e.message || e);
   }
} else {
   gSVGXMLRoot = evt.target;
   gSVGDOMDoc = gSVGXMLRoot.ownerDocument;
}

Original issue reported on code.google.com by osstec...@gmail.com on 10 Dec 2011 at 4:39

GoogleCodeExporter commented 9 years ago
We incorrectly specified a data-path and data-htc-filename which also included 
the path. Any improper definition causes 
FlashHandler._prepareBehavior
// attach SVG behavior to the page
ns.doImport(libraryPath+htcFilename);
to concat an invalid filePathName resulting in .htc not to load. No errors are 
thrown.
We have added a check in our startup for our stupid mistakes:
if(!gSVGDOMDoc.getElementsByTagNameNS) {
   console.error("_SVG:onLoad: .htc not loaded/initialized");
   return;
}

Original comment by osstec...@gmail.com on 20 Dec 2011 at 6:07