Script errors in IE
In IE 9 (and IE 10 under Windows 7), I have an error "SCRIPT5007: Unable to get value of the property 'setCurrent': object is null or undefined." (for reference, this error is followed by an error "SCRIPT257: Could not complete the operation due to error 80020101." as in this topic);
A WStackedWidget is controlled by a WMenu. These components (with many others) are included in a WTemplate.
When a call to WStackedWidget::setCurrentIndex is triggered, the error "SCRIPT5007: Unable to get value of the property 'setCurrent': object is null or undefined" occurs.
When the WTemplate is displayed and its content refreshed, the following code is executed and the error occurs:
[...] var cj32926=$('#WStackedWidget_oatkj7k').remove(); [...] Wt3_2_3.setHtml(j329, [...]); [...] $('#WStackedWidget_oatkj7k').replaceWith(cj32926); [...] $('#WStackedWidget_oatkj7k').data('obj').setCurrent(Wt3_2_3.$('contents-container_oatkj7g')); [...]
The "data" part of the $('#WStackedWidget_oatkj7k') object is destroyed by "$('#WStackedWidget_oatkj7k').remove()". After that, $('#WStackedWidget_oatkj7k').data('obj') is undefined and the method "setCurrent" failed.
I trace the problem in the source code of Wt 3.2.3 in DomElement.C, at lines 1322-1324:
// In IE, contents is deleted by setting innerHTML if (app->environment().agentIsIE()) out << ".remove()";
I don't understand the ".remove()" part of this code but I know in other browser than IE, the problem doesn't occur without this call.
Can someone understands this problem and helps me to solve it ?
Updated by Anonymous almost 8 years ago
Update to my previous post.
I found the "why" (but not how to solve the bug...) : the application uses some "WTemplate::bindString" and "WTemplate::bindEmpty" to update the content of the template. Those methods imply a refresh of all the template in the web page. If I remove those methods, all the stuff work flawlessly (no refresh of the template).
So : IE + WTemplate + WStackedWidget (or other complex WWidget ?) + WTemplate::bindString = bug
I hope that will help solve the problem !
Updated by Koen Deforche almost 8 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
Interesting bug, and I think your analysis is quite complete and correct. It seems that we need to call detach() instead of jquery's remove(). I'll test this when I have an IE around.