Opened 10 years ago

Closed 10 years ago

#8966 closed bug (invalid)

Jquery ui widget copy in IE7 and IE8

Reported by: grathad Owned by: grathad
Priority: minor Milestone: none
Component: ui.widget Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hello, I run into a strange behavior on jquery ui (tested on jquery 1.8.3, jquery-ui 1.9.2).

I have a parent and child widget, on the _create method of the parent I give the parent's self reference to the newly created child. When I try to access this reference from within the child all the function and properties declared after the building of the child are not available.

(function ($) {

$.widget("ui.parentWidget", $.ui.mouse, {

version: "@VERSION", widgetEventPrefix: "parentWidget",

_create: function () {

var self = this; self.child = $("<div/>")

.childWidget({ parent: self }) .appendTo(self.element);

self.parentName = "parent";

},

parentFeature: function() {

return "feature";

},

getChild: function() {

return this.child;

},

updateChild: function () {

var self = this; self.child.childWidget("update", self);

} });}(jQuery));

The child widget

(function ($) { $.widget("ui.childWidget", $.ui.mouse, {

version: "@VERSION", widgetEventPrefix: "childWidget",

_create: function () { },

childParent: function () {

return this.options.parent;

},

updatedParent: function() {

return this.newParent;

},

update: function(parent) {

var self = this; self.newParent = parent;

}

}); }(jQuery));

Now to test my output I just create a parent retrieve the child and read its parent and updated parent and read them.

var parent = $("<div/>").parentWidget();

parent.parentWidget("updateChild");

var child = parent.parentWidget("getChild");

var childParent = child.childWidget("childParent");

var updatedParent = child.childWidget("updatedParent");

childParent.parentName or childParent.parentFeature() are undefined on ie7 and ie8 and works fine everywhere else updatedParent possesses all its content.

Change History (4)

comment:1 Changed 10 years ago by Scott González

Owner: set to grathad
Status: newpending

This seems unrelated to the widget factory. Is there a reason you think the bug is caused by jQuery UI code?

comment:2 in reply to:  1 Changed 10 years ago by grathad

Status: pendingnew

Replying to scott.gonzalez:

This seems unrelated to the widget factory. Is there a reason you think the bug is caused by jQuery UI code?

That's true, I have the problem while using widgets in my code, but the bug may come from jQuery "object" management, I didn't try further than the present bug sample. To be totally fair, I added this ticket because I felt guilty to ask for it in stack overflow and not here.

Last edited 10 years ago by grathad (previous) (diff)

comment:3 Changed 10 years ago by tj.vantoll

Status: newpending

comment:4 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.