Skip to main content

Search and Top Navigation

#8796 closed bug (notabug)

Opened November 09, 2012 01:22PM UTC

Closed November 09, 2012 01:32PM UTC

Last modified November 09, 2012 02:46PM UTC

cannot call methods prior to initialization regression

Reported by: frediani.adrien Owned by:
Priority: minor Milestone: 1.10.0
Component: ui.widget Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:
Description

I noticed a regression, even though this look weird, calling destroy method before widget's instanciation was not breaking in 1.8 version. It does in latest 1.9.

Here a simple testcase:

http://jsbin.com/iwisuj/2/edit

on 1.8 destroy method is not called, but widget is correctly created.

on 1.9 following error is breaking the widget (not displayed correctly)

-> Uncaught Error: cannot call methods on test prior to initialization; attempted to call method 'destroy'

Attachments (0)
Change History (4)

Changed November 09, 2012 01:32PM UTC by scottgonzalez comment:1

component: ui.coreui.widget
resolution: → notabug
status: newclosed

This is not a bug. If we wrote code specifically to throw an error, why would you think it was unintentional? How does calling a method on something that's not initialized make sense?

Changed November 09, 2012 02:27PM UTC by jzaefferer comment:2

Throwing erros when calling invalid methods is mentioned in the upgrade guide, but calling methods on uninitialized widgets isn't: http://jqueryui.com/upgrade-guide/1.9/#calling-an-invalid-method-now-throws-an-error

Changed November 09, 2012 02:33PM UTC by frediani.adrien comment:3

Of course, it doesn't make any sense but this could still cause a regression on 1.8 widgets that are doing this bad practice, even with the $.uiBackCompat = true; it still fails which should not be the expected behaviour I guess.

Changed November 09, 2012 02:46PM UTC by scottgonzalez comment:4

While this was previously a no-op, I don't believe this was ever defined behavior. Both cases (calling methods that don't exist and calling methods prior to initialization) are just wrong.