4

In my SP2013 environment, I use jquery, but had the issue of the $ clashing with Sharepoint's own $. The original thread was here

Does Sharepoint 2013 really have a jquery conflict with $?

In there, this link was brought up

https://www.spcaf.com/blog/sp-context-dev-part-6-jquery-vs-sharepoint/

which introduces SharePoints own mQuery. So now I am wondering, for long term use, is it better to switch to mquery completely and get rid of jquery? Or just continue to use jquery. Because if I use mquery, then its dependant on SharePoint mquery version which may change in future versions like SP2016 or the next version. This would break code, or worse, they could drop mQuery for something better (from themselves or some other company). They did this with Full Text Query, and said switch to KQL.

However if I stay with jquery, then even if they change, I can always keep using the jquery version file that worked. So it seems like jQuery is more stable in terms of long term usage.

Does anyone have any advice for this issue?

Thanks

  • Lets take another step, post 3 uses of jQuery you want to use and I will show you the noQuery way – Danny '365CSI' Engelman Jan 14 '16 at 21:00
  • I know that anything you can do in jquery you can do in plain javascript and mostly in mquery. But this is not what I am asking about. Now i'm just concerned about the stability of mquery as I described above in the large paragraph. – omega Jan 14 '16 at 21:02
  • nothing is guaranteed, mQuery or jQuery its both another library you have load (SharePoint does not load it by default on every page) Yes. if you code for jQuery 1.9 it will work forever in the future; provided you load jQuery 1.9 and no other Add-in, Browser extension or whatever destroys your precious $ ... that means you never have 100% control – Danny '365CSI' Engelman Jan 14 '16 at 21:05
  • So then basically the best way to make sure it works forever, is to use jquery version X, and then use the self executing anon. function passing in jquery.noConflict? Because if you do that, then even if you load other jquery libraries versions, or addins or browser extensions, then it will still work? – omega Jan 14 '16 at 21:10
4

I would definitely suggest using jQuery. mQuery is really Microsoft's own implementation of some of the same concepts, but it's for their use. If they documented it and made some sort of contract with us about its functionality and stability, that would be one thing, but they never have. Plus, there's a HUGE jQuery user community; I'd be willing to venture that there's none for mQuery.

  • 1
    Well, that Huge jQuery community is a bunch of people who do not know what JavaScript can do and 90% of them copy/paste code from blogs without even understanding what jQuery IS. As I said, show me 3 uses of jQuery and I'll match them with pure JavaScript code. (note: I do use jQuery.. but I know 100% why and when) – Danny '365CSI' Engelman Jan 14 '16 at 21:57
  • 1
    @Danny, that seems a bit harsh. Every tool has a purpose, and jQuery can speed up your developoment time, should you choose to use it. If you'd prefer to use pure JavaScript, that's great, but that wasn't the original question. – Marc D Anderson Jan 16 '16 at 15:34
  • I'm dutch, blunt is our middle name :-) I disagree about jQuery (but only since Microsoft no longer supports IE9 now (jan 12th)). It was great when it was great, but we have to start deprecation some time (they killed my Flash skills too). 80% of its use does not go past $(elementId) every modern HTML5 JavaScript developer should know about document.querySelectorAll. True, if you have done jQuery for 10 years you can develop faster (I still use $.ajax) but we have to learn new ways, I threw down the gauntlet... show me something jQuery and I will match it with vanilla JavaScript – Danny '365CSI' Engelman Jan 16 '16 at 19:38
  • 2
    jQuery developers are the Cobol developers of 2017 – Danny '365CSI' Engelman Jan 16 '16 at 19:42
2

mQuery lacks most of what you require and is being abandoned.

Use jQuery if you want that speed to market which it can provide through familiarity.

But yes use noConflict mode with SharePoint 2013 and below.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.