Reportable bug or not? IE9 error on interacting with hidden elements if document.domain is set

Reportable bug or not? IE9 error on interacting with hidden elements if document.domain is set

Hello.

I have a case where an element is hidden on page load by CSS using 'display: none'. I want to make it visible some time later in response to an event, but in IE9 the jQuery methods show() and toggleSlide() trigger an error when they are called: 'SCRIPT5: Access is denied.'

This error only occurs when the document.domain value has been set in the page, even if it it simply being set to the value it should have by default. It looks like 'css_defaultDisplay' is involved: in trying to calculate if the element is visible on the page, an iframe is created, and there is a communication breakdown there due to the document.domain assignment.

I can't really remove the document.domain assignment from my code, as it is required to enable cross-subdomain iframe communication elsewhere in my project. I can work around it, by using an inline style attribute on the element, but I wondered if this is something I should raise as a jQuery bug. Should jQuery be compatible with JS authors changing the document.domain, or am I expecting something unreasonable? Is there a reason why I should never modify document.domain?

A reduced test case is described below. I would be grateful for any input, even if that is just confirmation that others can replicate this issue. Thanks.
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <meta charset="utf-8" />
  5.     <!--
  6.     The issue manifests if display: none is declared inline
  7.     (as below) or if it is linked to, unless it is ONLY declared
  8.     using the style attribute on the div element itself.
  9.     -->
  10.     <style>
  11.       div {
  12.         display: none;
  13.       }
  14.     </style>
  15.     <script src="http://code.jquery.com/jquery-2.0.3.js"></script>
  16.     <script>
  17.       // Running this page through IIS, rather than from the
  18.       // filesystem, set the document.domain to the root domain
  19.       // it is being viewed on, leaving out any subdomains. This
  20.       // is done to enable access to iframes across the subdomains
  21.       // in other code. The addition of this line causes the error
  22.       // 'SCRIPT5: Access is denied.' in IE9 on Windows 7,
  23.       // triggered by the function 'css_defaultDisplay' in jQuery.
  24.       // Other, modern browsers seemed fine (Chrome 31, Firefox 23,
  25.       // IE11). IE8 or IE9 running jquery-10.0.2 seem to have the
  26.       // same problem.
  27.       document.domain = 'mydomain.com';
  28.     </script>
  29.   </head>
  30.   <body>
  31.     <div>Hello</div>
  32.     <script>
  33.       $(document).ready(function() {
  34.         $('div').show();
  35.       });
  36.     </script>
  37.   </body>
  38. </html>