Rich-text Reply

What's included in Optimizely's jQuery version?

Ehsan 10-22-15

What's included in Optimizely's jQuery version?

Hi Optiverse, My name is Ehsan, and I'm on the Technical Support team here at Optimizely.

 

Based on some feedback from the Community, I've written up this article that clearly explains how to determine which methods are available in the default Optimizely 1.6.4 version. My article also explains how to easily see the differences between Optimizely's full version of jQuery vs. Optimizely's default trimmed version of jQuery. It also explains how to see the differences between your own jQuery version and Optimizely's versions. 

 

Check it out here: https://help.optimizely.com/hc/en-us/articles/202480860#jS

 

@nap0leon and @seanemmel_ba - do you have any feedback on this article? Is it helpful? I know it was mentioned in this thread that it's hard to keep track of methods are and are not included. 

 

Here's a quick snapshot from my article: 

 

View the 116 core methods from jQuery 1.6.4 (Optimizely's default setting) all in your browser console by entering the following code:

 

 

l = Object.getPrototypeOf(optimizely.$("body"))
var optimizely_functions = []
for(var g in l){
 optimizely_functions.push(g)
}
console.log(optimizely_functions)

Here they are visually:

included.png

Optimizely

JDahlinANF 10-23-15
 

Re: What's included in Optimizely's jQuery version?

@Ehsan - this is awesome - thanks!!!

JDahlinANF 10-23-15
 

Re: What's included in Optimizely's jQuery version?

@Ehsan - Some useful information may be to document the size difference between the full version of 1.6.4 vs the trimmed down version - perhaps even on the Javascript Configuration tab next to each radio button.

 

 o  Do not include jQuery in project code
o Include trimmed jQuery in project code (recommended) - 34Kb o Include full jQuery in project code -- 48Kb

Separately, moving from 1.6.4 to 1.7+ would be sweet -- .on() rocks for setting up event listeners -- but, if the Opt engine is based on 1.4.2 methods I can appreciate why this would not be feasible.

Ehsan 10-23-15
 

Re: What's included in Optimizely's jQuery version?

Hey @nap0leon -

 

The size difference would be super useful, I have filed a ticket with the engineering team to look into it.  

 

 

Keep in mind that you can use .on() if you include jQuery 1.7.X above the Optimizely snippet and select "Do not include jQuery in project code" in the jQuery settings.  

 

Alternatively, you can keep jQuery in the project code and prepend the line of variation code using the .on() method with "window."

Optimizely

Re: What's included in Optimizely's jQuery version?

[ Edited ]

Ehsan,

 

This is all great, and thanks for keeping us in the loop. I may end up making a little bookmarklet for this that presents this info in a GUI (e.g., modal, like I did here: 

https://gist.github.com/seanemmel-ba/0c2679ea3dcebfe7e560

 

I think it would be helpful to see what methods are in Optimizely's version of jQuery, what methods are in the site's current version of jQuery, and what methods are different between the two, all as separate options that could be selected from within the modal. Alphabetizing them would also probably help people to find particular methods in question quickly.

 

Anyway, glad to see that we have the ability to grab all of this info now. I'll keep you all up to date whenever I get some time to build this out.

-- Sean
UI Developer @ Blue Acorn

optimizely developer certification