compatibility with jquery(1.9.1) + mem leaks + infinit loop fix

hi,

I did some changes so we can use the jquery(1.9.1); I also fixed issues related
to memory leaks and an infinite loop when setting the theme on some components

can you please merge ?

thanks