{"id":28,"date":"2008-06-18T00:00:00","date_gmt":"2008-06-18T00:00:00","guid":{"rendered":"http:\/\/bloodforge.com\/?p=28"},"modified":"2020-02-20T01:47:12","modified_gmt":"2020-02-20T01:47:12","slug":"ie8-and-ajaxcontroltoolkit-visibility-bug","status":"publish","type":"post","link":"https:\/\/bloodforge.azurewebsites.net\/index.php\/2008\/06\/18\/ie8-and-ajaxcontroltoolkit-visibility-bug\/","title":{"rendered":"IE8 and AjaxControlToolkit &#8211; Visibility bug"},"content":{"rendered":"\n<p>Well, I finally downloaded IE8 to see how some of the sites I&#8217;ve worked on behave.&nbsp; Most things work just fine, however, I did find a pretty significant problem with the AjaxControlToolkit.<\/p>\n\n\n\n<p>I&#8217;ve been using the Tab control quite a bit, and I noticed that, when switching between tabs, the new tab was not showing up.&nbsp; The old tab was hiding, though&#8230;&nbsp;<\/p>\n\n\n\n<p>Debugging has led me to the setVisible method located in &#8220;Common\/Common.js&#8221; in the AjaxControlToolkit.&nbsp; Specifically, the problem existed in the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (element &amp;&amp; value != $common.getVisible(element)) \n{\n  if (value) \n  {\n    if (element.style.removeAttribute) \n    {\n      element.style.removeAttribute(\"display\");\n    } \n    else \n    {\n      element.style.removeProperty(\"display\");\n    }\n  } \n  else \n  {\n     element.style.display = 'none';\n  }\n  element.style.visibility = value ? 'visible' : 'hidden';\n}<\/code><\/pre>\n\n\n\n<p>In the above code, removeAttribute() was being called, but the display attribute remained (display=none).&nbsp; I looked up the&nbsp;<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/cc304687(VS.85).aspx\">removeAttribute method<\/a>, and it does return a boolean value indicating if the method was successful or not.&nbsp; Well, as it turns out, the method (for whatever reason) is not successul in IE8!<\/p>\n\n\n\n<p>I&#8217;m not sure why this fails in IE8, but it does cause a problem.&nbsp; Fortunately, there&#8217;s a pretty quick fix to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (element &amp;&amp; value != $common.getVisible(element)) \n{\n  if (value) \n  {\n    if (element.style.removeAttribute) \n    {\n            if(!element.style.removeAttribute(\"display\"))\n            {\n               element.style.display = '';\n            }\n    } \n    else \n    {\n      element.style.removeProperty(\"display\");\n    }\n  } \n  else \n  {\n     element.style.display = 'none';\n  }\n  element.style.visibility = value ? 'visible' : 'hidden';\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Well, I finally downloaded IE8 to see how some of the sites I&#8217;ve worked on behave.&nbsp; Most things work just fine, however, I did find a pretty significant problem with the AjaxControlToolkit. I&#8217;ve been using the Tab control quite a bit, and I noticed that, when switching between tabs, the new tab was not showing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/28"}],"collection":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":1,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"predecessor-version":[{"id":29,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/28\/revisions\/29"}],"wp:attachment":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}