Project

General

Profile

Actions

Bug #1586

closed

Script errors in IE

Added by Anonymous almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
11/29/2012
Due date:
% Done:

0%

Estimated time:

Description

Hello,

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);

The context:

A WStackedWidget is controlled by a WMenu. These components (with many others) are included in a WTemplate.

My analysis:

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.

The JavaScript part of the WStackedWidget is created by:

new Wt3_2_3.WStackedWidget(Wt,Wt3_2_3.$('WStackedWidget_oatkj7k'));

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.

My question:

Can someone understands this problem and helps me to solve it ?

Actions #1

Updated by Anonymous almost 12 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 !

Actions #2

Updated by Koen Deforche almost 12 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche

Hey,

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.

Regards,

koen

Actions #3

Updated by Koen Deforche almost 12 years ago

  • Status changed from InProgress to Resolved
  • Target version set to 3.3.0
Actions #4

Updated by Koen Deforche almost 12 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF