fb79432117c7c5808d478bda90dfce5f819cb3fb |
|
11-Jan-2011 |
Luke Smith <lsmith@yahoo-inc.com> |
Best effort workaround for IE9 bug
"Invalid this pointer used as target for method call"
is resulting from toCssText: workerStyle.cssText = base || EMPTY;
It appears to be a getter/setter issue, but it has been very
difficult to reproduce reliably. The error occurs intermittently,
then the page will start working. Whether the bug manifests appears
to be affected by page load time, or perhaps the number of resources
that are dynamically loaded. Personally, I've been unable to repro the bug when IE's debugger tools are open, but Matt was able to for a short time (then it started working for him).
Like I said, hard to get a repro.
Attempts to reduce the failure case have been largely unsuccessful,
as the code starts working again. I was able to repro with
YUI().use('stylesheet', 'overlay', function (Y) {
setTimeout(function () {
new Y.StyleSheet().set('h1', { color: 'red' });
}, 2000);
});
but only for a time. A hacky report() function was
successfully employed with a modified stylesheet_theme_source.php
from the StyleSheet example (adding <ul id="out"></ul> and replacing
the JavaScript with the code noted above) to isolate where in the
code the error was being thrown. With a try/catch around the
assignment to workerStyle.cssText, report() did show code execution
flowing into the catch block, but after remediation steps were added
to the catch block, I was unable to reproduce the error, or even get
a report() call from the catch block.
So it looks like the style collection is corrupt and rather than
bang my head against the wall any longer (though I will file a bug
with IE), a best guess workaround is being added to replace the
style collection and try the assignment again. |