Skip to content

jQuery-UI widget breaks if using as a module #2015

Closed
@MhMadHamster

Description

@MhMadHamster

Hello, currently in our project we are using jquery-ui widgets as a separate modules like this:

import dialog from "jquery-ui/ui/widgets/dialog";

dialog({ ...options }, document.querySelector(".some-element");

However in 1.13.0 we cant use widgets this way, now it fails to initialize a widget with an error:
Uncaught TypeError: Cannot read properties of undefined (reading '_createWidget')

Even though you still able to use widgets "normally":

import "jquery-ui/ui/widgets/dialog";

$(".some-element").dialog({ ...options });

would be nice to fix this issue, especially since it looks unintended.

I believe problem was introduced in this commit: 70dae67
By adding "use strict" now this code: https://github.com/jquery/jquery-ui/blob/1.13.0/ui/widget.js#L80 fails, since this is undefined.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions