New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jquery-ui stopped working #41
Comments
This could be because Cobweb used jQuery v2.x and there was no chance in the current configuration with package management JAM to update jQuery. I decided to switch to NPM as package management system and restructured the project much. I used this occassion also to rename Cobweb into Excite X3D and created the new project https://github.com/create3000/excite. Excite X3D uses jQuery v3.2.1 now. I am still preparing the launch of Excite X3D but you can already use and test it. This means jQuery UI must be compatible with the jQuery version. URL's are: Best regards. |
This uses the latest query (3.2.1) and jquery-ui(1.12.1) but has the same problem The problem seems to be that the page script is executed before jquery is loaded: Somehow the loading sequence must have changed with npm and the restructuring. I tried a couple of ways (body onload, script tag order) to force loading jquery before the page script but without success. Perhaps the page ui script has to go inside the X3D callback now although it is otherwise unrelated to X3D. |
uses jquery inside the X3D callback but ui is also not available. |
Investigated the HTML file and send you now a working file. Although jQuery is included again it could be left away.
|
Thanks, that works: But jquery-ui 1.12.1 (the latest) does not work for some reason: Do you know why it is necessary now to use jquery-ui from within a jquery callback ?
It seems less comfortable than it was for 3.3, |
Switching down to jquery-ui 1.10.4 also works for the cobweb_dom example and No other changes were necessary. |
Out of curiosity, I found that jquery-ui 1.10.4 is in deed the latest version which works and 1.11.0 the first which does not. The only hint in the changelog at http://jqueryui.com/changelog/1.11.0/ is perhaps the addition of AMD support via UMD wrappers but I do not understand enough about modules and npm to find out more. |
Using jQuery UI or jQuery within the main callback ensures that the document is loaded. Writing |
Maybe should file a bug to jQuery UI if it is otherwise not working, need some test first. |
Ok. I posted a question to their forum http://forum.jquery.com/using-jquery-ui http://forum.jquery.com/topic/jquery-ui-1-11-0-together-with-jquery-packaged-library Perhaps better to use other UI libraries anyways. |
Don't use jquery-latest! It is no longer the "latest". It is an obsolete version that is not likely to work well with modern browsers. And current jQuery UI doesn't work with it. Please burn whatever documentation told you to do that. Always check the freshness date on books, tutorials, and blogs! If you go to the official jQuery site, you will find nothing that suggests you ought to load jquery-latest. Load a SPECIFIC VERSION of jQuery. It is a bad practice to assume that the "latest" version of a library is appropriate for you project. Here's an explanation of why it is still maintained on the CDNs - so as not to "break the Internet". If Cobweb includes jQuery itself, and "steals $" you will have further steps to take. But at least use a jQuery that works with the jQuery UI you are using. jQuery UI 1.10 is unlikely to work well with modern browsers. Using ancient JS library versions is seldom a solution, unless you can lock-down your users to ancient browsers (like the U.S., Navy...) |
is trying to use the cobweb provided jquery which is v.3.2.1 along with jquery-ui 1.12.1 Could you exand on the further steps which could be taken, please ? |
jQuery UI 1.12.1 will work with jQuery 1.7 or later. It will not work with jquery-latest, since that is an ancient jQuery 1.11.1. To instantiate jQuery UI widgets, you need to wait for:
Under normal circumstances, loading scripts synchronously in If you (or Cobweb) are using some asynchronous loader, it is up to you to research how to achieve the above conditions. Usually, such loading schemes will have their own callback equivalent to Additionally, it should be obvious that jQuery need to be loaded prior to jQuery UI. Again, if some asynchronous scheme is used, you need to insure that the load order using whatever means that scheme requires. |
Did you look at the console? You have an error in your cobweb load. Uncaught error: mismatched anonymous define() module. Hard to diagnose, since you are loading a minified cobweb. But I notice that it loads AFTER your call to .slider() so if it has jQuery built-in, your code can't possibly work. (Question: does minified Cobweb actually expose I guess there is some asynchronous loading going on here. You need to take it up with the Cobweb folks. Don't load scripts in body! During debugging, don't load minified scripts, it only makes it difficult to see what is going on. And jQuery UI can't possible work with jQuery commented-out. Please go to jQuery UI website and FOLLOW THE INSTRUCTIONS for basic jQuery UI usage. Get it working first without Cobweb. Scripts loaded in |
Thanks, for looking into this.
|
Your issue really has nothing to do with either Cobweb or jQuery or jQuery UI. If you are using some module packager or asynchronous loading or what-not, you need to learn how to use them. I'd suggest you:
When you make Fiddles, leave out parts that have nothing to do with the issue you are illustrating. And for gosh sakes, use the Tidy button. It takes one click. I've fixed your first Fiddle. (I do realize it "worked" before I changed it. But if you don't follow conventions, you are going to make it difficult for anybody to help you.) |
I made you a new Fiddle with JUST cobweb 3.3. https://jsfiddle.net/g00Lgdtt/ If you add /show, you can then easily use browser inspection tools. Use the tools in every desktop browser to inspect/debug: https://jsfiddle.net/g00Lgdtt/show/ It is trivial to determine that Cobweb doesn't expose jQuery, at least in the minified version from their CDN. Just type Please just follow a disciplined approach, testing one thing at a time. I'd suggest you make a test with the unminified version, then with minified/unminified of the latest build. Or anybody here who is familiar with Cobweb can probably answer if it exposes jQuery, or you can just go to the Cobweb site and read the instructions. Cobweb github says NOTHING about jQuery. I don't know why one would assume that it exposes it or even uses it. |
Cobweb master ONLY (no sliders, no jQuery UI): https://jsfiddle.net/rezjLgpd/
However, I can't guess if it is jQuery, or something else that somebody decided to call $. It's probably a bad idea for libraries to steal $, given the prevalence of jQuery. It only makes things difficult for developers. You can load your own jQuery, but will need to use As well, the Cobweb CSS file you linked is missing, 404 error. And I get a message:
I am using Chrome 60.0.3112.101 This illustrates why it is so important to test one thing at a time. |
Works: https://jsfiddle.net/80f8vmvy/ Cobweb is going to make 99% of developers hate them by adopting $ for their own use, though. Hopefully it is a bug/oversight. |
Wow, why hold back ? Yes, hopefully it is. Thanks again, closing. |
The master version of Excite X3D will not expose any global variable to the JavaScript window object except the X3D function object. This means if you want to use jQuery you have to include your own version which is probably always desired. Internally Excite X3D calls jQuery.noConfict(true) after load. Now, jQuery can be included before or after Excite X3D. |
This page uses jquery outside of X3DCanvas and it works with 3.3:
https://rawgit.com/andreasplesch/Library/45e56e81ebaafc376de420c0fe0aba760ba981b2/Tests/uses_jquery.html
(with cobweb_dom https://rawgit.com/andreasplesch/cobweb_dom/2d0335188c97cba30c5872e88898293a576215c3/tests/jqueryui_cobweb.xhtml
)
but it does not work with the current master:
https://rawgit.com/andreasplesch/Library/b063a2ff06917df8ffde30f1582e5b0d6d4bc8d6/Tests/uses_jquery.html
(with cobweb_dom https://rawgit.com/andreasplesch/cobweb_dom/dc19614a6f98b2b2a210bb468e7f8c37a302abab/tests/jqueryui_cobweb.xhtml )
I have no clue why.
The text was updated successfully, but these errors were encountered: