18

I have to preface this with the fact that I love jQuery as a JavaScript language extension and YUI as a rich set of free controls. So here is my question, is there going to be any problems down the line if I mix jQuery and YUI together in an MVC app I am working on.

I want to use jQuery for the heavy lifting on the DOM and I want to use YUI for the rich user control set. This is an internal application and will never see the light of day outside of the organization I work for.

If anybody has experience with mixing these two frameworks I would love to hear what your experience has been.

Nick Berardi
  • 54,393
  • 15
  • 113
  • 135

5 Answers5

13

Speaking from some experience in developing a small tool myself, I've used YUI's rich control set with Prototype for DOM manipulation in the past and experienced no issues. Admittedly, this was a small tool that didn't use a wide array of the controls.

Even so, I'm always hesitant to use multiple frameworks on my web projects; however, if you're only using jQuery's DOM functionality and YUI's control functionality, then I think you're fine - there's not really a conflict of interest there. Plus, with jQuery's noConflict() mode and YUI's namespacing, the two frameworks really shouldn't trump one another.

Tom
  • 15,527
  • 5
  • 48
  • 62
  • Similarly, I've used YUI (for layout grids, menuing) and jQuery (for general purpose DOM traversal/manipulation), both of which take decent care with namespacing (when mixing jQuery with other frameworks/libraries use jQuery.noConflict() to prevent its use of the "$" variable). – micahwittman Oct 14 '08 at 16:18
6

This is an old question, but wanted to add a link to jQuery's doc on this topic...

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

EBarr
  • 11,826
  • 7
  • 63
  • 85
  • +1. Following the advice from that doc, I simply _included jquery before YUI_, and things worked well enough for the proof-of-concept I was working on. – Frank Farmer Jan 30 '10 at 00:47
4

I regularly use jQuery with YUI (jQuery for most things, YUI for the UI elements) with no trouble.

Note that YUI 3 will introduce jQuery style selectors and chaining:

http://developer.yahoo.com/yui/3/

Parand
  • 102,950
  • 48
  • 151
  • 186
0

I think it shouldn't be a problem because YUI is all contained in "namespaces", so it shouldn't break anything (I don't know if jquery break things around YUI, but as long as it doesn't extend basic object there shouldn't be any problem). I remember Dustin Diaz come out with a library similar to jquery and builded around YUI: http://www.dustindiaz.com/introducing-ded-chain/ I tried to download it now, but the site is now offline.

kentaromiura
  • 6,459
  • 2
  • 21
  • 15
0

yes, using jquery along side YUI is definitely possible, particularly because both jquery and YUI have taken strong steps to prevent global namespace pollution. However, implementing such a combination unnecessarily provides a lot of redundant functionality. I would urge you to use YUI3 which provides most of the functionality of Jquery and much more. YUI3 has a much more cleaner and succinct syntax and is very well documented. However it is possible that you are using some jquery plugin, whose YUI alternative is not available. In such case I would recommend you take a look at Jquery UI or wijmo for your UI needs or,use a light weight UI toolkit like UKI. Alternatively, you could also take a look at ExtJS that has a Jquery adapter available through which you can take advantage of your familiarity with jquery as well as the rich widgets of extjs.

lorefnon
  • 12,875
  • 6
  • 61
  • 93