Tonight I posted the first (we always hope the only) beta for SPServices v0.7.0. Initially I was calling this release v0.6.3, but when jQuery 1.7 was released and it caused problems with SPServices, I decided to bump the version so that the sevens matched. Get it? 1.7 and v0.7.0? Such are the complex decisions we make about software version numbering. (Those of you who wonder why I still am using sub- version 1.0 numbering – it’s just because I feel like it. No real reason.)
One of the biggest things in this new beta is compatibility with jQuery 1.7. In a previous post, I talked about the fact that the
.find("[nodeName='z:row']") syntax no longer worked with jQuery 1.7. This was a real annoyance, but due to some great work by Steve Workman, I think there’s an even better selection method in v0.7.0. Unfortunately, if you’d like to move to jQuery 1.7 in your environment, you’ll have to change the syntax in all of your code as well. What the jQuery team decides to change is out of my hands, of course, so occasionally this sort of thing will happen.
There’s an new function in SPServices called SPFilterNode, which is really quite simple, but it solves the problem, based on Steve’s work.
Here is an example of the syntax for calling this new function:
There are several benefits to having this function. First, it works in jQuery 1.7 as well as an earlier versions, going back at least to version 1.4.2, which is as far back as I tested. Second, as you can see if you read through Steve’s benchmarking results, it’s very efficient, even more efficient than the
.find("[nodeName='z:row']") syntax. Third, if there is a change like this in a future version of jQuery, I can simply replace the function’s workings and all will continue to function well. Note that you only need to use SPFilterNode, and the
.find("[nodeName='z:row']") syntax for that matter, when SharePoint’s Web Services return namespaced elements in the XML *and* you want to ensure cross-browser compatibility. If the nodes have names like “item” or “region”, or any other simple name which isn’t preceded with something and a colon, then .find(“item”) or .find(“region”) works fine. Of course, SPFilterNode will also work, but it’s not necessary.
If you are using SPServices and can do some regression testing, I’d certainly appreciate it, as will the other almost 8000 people who have downloaded SPServices v0.6.2 and may want to upgrade. Just be sure that you use the new SPFilterNode function if you are retrieving data from GetListItems with jQuery 1.7 or else it will seem as though you aren’t get anything back from the call.
I’ll publish the rest of the release notes when I release a stable version of v0.7.0, but if you’d like to see what’s in this version, check out the download page. As usual, it’s a mix of bug fixes, performance enhancements, and new features,.
If you found this post helpful, please consider visiting one or more of the advertisers on the page. Writing good, in depth blog posts takes time, and advertising revenue - though by no means large - helps to offset the effort.