August 20, 2012

mQuery for SharePoint 2013

mQuery for SharePoint 2013

I was poking around the new Office365 preview and started writing some custom JavaScript tweaks when I found a JavaScript class file called mQuery.js. This was confusing to me, as I had heard from some of the rumors that SharePoint 2013 was going to ship with jQuery out of the box. So I started probing into this new mQuery.js file, and low and behold it looks very similar to jQuery’s event features. Here is the mQuery.js file from their CDN, and here are some functions from the file:

  • addClass
  • css
  • bind
  • removeClass
  • click
So how can you make use of these functions? mQuery uses the no conflict technic that jQuery uses, so instead of your typical jQuery select $(‘#myID’).hasData(); you can use m$(‘myID’).hasData();. This way you can use mQuery you can still use all your jQuery functions that you have already written. At the end of the day I really hope that Microsoft decides to use jQuery and publishes these custom functions as plugins. But I don’t know how realistic this is, so we might want to start using the built mQuery functions.

Leave a Reply

Your email address will not be published. Required fields are marked *