AnsweredAssumed Answered

DOM "stroke-width" attribute returns undefined in IE. Works in all other browsers.

Question asked by roessera on May 24, 2012
Latest reply on May 24, 2012 by DSwingley-esristaff
this.line = this.obj.graphics[gfx].getDojoShape().getEventSource();                                                      $(this.line).attr("stroke-width") 


This code returns the stroke-width value from the DOM element on a line on my map.

If I use alert() to capture the object in IE 7/8, it displays as undefined. In firebug for Firefox/Safari/Chrome, they all display the correct value.

Here is the code I've written so far (sorry it's a bit messy, I use jQuery for DOM manipulation, instead of destroying/adding new objects as dojo does):

var legendPane = $('div#legendPane')  $(legendPane).on("mouseenter mouseleave", "table.esriLegendLayer > tbody > tr", function(evt){         this.obj = $(this).data()                  if(typeof(this.obj) == "object"){             if( evt.type == "mouseenter"){                 for(gfx in this.obj.graphics){                     if (this.obj.graphics[gfx].geometry.type == "polyline"){                         try{                             this.line = this.obj.graphics[gfx].getDojoShape().getEventSource();                             ////////////////////////////////////////                                                         ///////displays 'undefined' in IE/////                                                         ///////////////////////////////////////                                                          alert($(this.line).attr("stroke-width"))                                                                                        $(this.line).attr("stroke-width") == 2 ? $(this.line).attr("stroke-width", "8") : null;                         }catch (err){}                                                     }else if (this.obj.graphics[gfx].geometry.type == "point") {                         try {                             this.point = this.obj.graphics[gfx].getDojoShape().getEventSource();                             $(this.point).attr("r") == "8" ? $(this.point).attr("r", "13") : null;                              $(this.point).attr("r") == "2.5" ?  $(this.point).attr("r", "4") : null;                                  } catch (err) {}                         }                 }             }else if.....

Outcomes