Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7563449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:40:10+00:00 2026-05-30T13:40:10+00:00

I develop and maintain a jQuery widget called jquery-ui-picklist . I’ve been wanting to

  • 0

I develop and maintain a jQuery widget called jquery-ui-picklist. I’ve been wanting to remove the dependency on jQuery UI so that it can be used in both jQuery and jQuery UI apps alike.

I’ve avoided the transition, until yesterday, when I figured out I could simply do something like this:

(function($)
{
    if($.widget == null)
    {
        // Contents of jquery.ui.widget.js, straight from jQuery UI, goes here.
    }

    $.widget("awnry.pickList",
    {
        // My widget's actual code goes here.
    });
}(jQuery));

(If you’re interested, the widget’s full source can be found here.)

Needless to say it feels dirty and hacky to be including, verbatim, a vendor’s code like this. Is there a more correct, elegant, or better way to drop the jQuery UI dependency without making my users add another JS include to their pages?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:40:11+00:00Added an answer on May 30, 2026 at 1:40 pm

    After considering my options, I ended up removing the if() statement and the Widget Factory code from my widget.

    Users of my widget have two choices. If their page includes jQuery UI, nothing extra must be done. If their page includes only regular jQuery, jquery.ui.widget.js (which is packaged with my widget for convenience’s sake) must also be included.

    My reasons for making the decision:

    • Widget code isn’t cluttered up with vendor code.

    • Widget is decoupled from any specific Widget Factory implementation or version. In other words, $.Widget can come from jQuery UI or jquery.ui.widget.js or wherever; the widget doesn’t care.

    • Widget still works with regular jQuery, yet I still benefit from using the Widget Factory.

    • Upgrading the Widget Factory is simply a matter of dropping in a new file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a suite of webpart controls that I maintain and develop for our
I develop / maintain an application that takes a long time to build (as
Is it possible to develop controls that will work in both Asp.net Web Forms
I want to develop a simple java based application that can connect to facebook
Suppose I develop an application with the logic as a CLI program that can
I develop and maintain small intranet web apps written in JSP and Java. They
We develop Win32 application that access to SQL 2005 database through Linq to SQL.
I develop web applications and in my job so far, I have been waging
I develop a variety of applications and have 3-4 miscellaneous libraries that I reuse
This is a question to all of you out there who develop for both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.