Discussion:
i love wordpress support for php functions, but this what happens with every upgrade of jquery...
Konrad Karpieszuk
2013-10-09 09:31:42 UTC
Permalink
Hi people

I think one of most important thing in wordpress is that it supports even
old wordpress api functions (just throwing notice that this is depracated
and you should consider to use new way of doing this thing). This very
important argument when you propose to your customer to build website on
wordpress: you can tell him that website will work for years, and he/she
don't have to be affraid of making wordpress core upgrades.

But this what happens after every upgrade of wordpress which delivers new
version of jQuery i can comment only in three letters: WTF?! :)

Today i upgraded one website of my customer to wp 3.6.1 which brings jquery
1.10. And after that all sliders based on jquery tabs stopped to work.

I found reason: in my sliders i heavily use method 'selected' which in new
version of jQuery is called 'active' and i use 'fx' - now i should use
'show' option.

I changed that, but what with other websites? I developed tens of them
where i am sure problem will be the same after wordpress upgrade.

And also few months ago i sam that jquery tabs method 'rotate' also was
castrated. Then i found some plugin which brought it back.


But this is silly! I include jquery and jquery-ui-tabs using
wp_enqueue_script every time - in the way how codex.wordpress suggest to do
this. Now it looks that because of wp upgrades you cannot depend on this.

I cannot tell my customers not to upgrade wordpress, because of that
animations will stop to work. Also i cannot charge thetm for my additional
work after every wordpress upgarde - this is not the way how i cooperate
with customers.

I know that the problem is in jQuery way of development, not in wordpress,
but maybe you - wordpress core developers - have some idea how to deal with
it?

--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
Nikola Nikolov
2013-10-09 09:42:48 UTC
Permalink
Well a simple solution is to simply register your own version of jQuery and
stick to it. Keep in mind that this might break other plugins that depend
on the latest version of jQuery.

Here's a sample code:

function my_enqueue_scripts() {
// De-register the core version of jQuery
wp_deregister_script( 'jquery' );

// Register our version of jQuery and our script that depends on that
version of jQuery
wp_register_script( 'jquery', get_bloginfo( 'template_directory' ) .
'/js/jquery.js' );
wp_register_script( 'my-jquery-dependent-script', get_bloginfo(
'template_directory' ) . '/js/script.js', array( 'jquery' ) );

// Enqueue the custom script
wp_enqueue_script( 'my-jquery-dependent-script' );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts', 10 );


Now, please keep in mind the following: someone else might come after you
and make changes on the theme, or poke around it. Please leave a note as to
why exactly you're using the exact version of jQuery that you're using, so
that the next person doesn't suffer too much :) And I assume that the
syntax that comes with jQuery 1.10 will stick around for longer, so at
least update your themes to use 1.10 and then use local version of 1.10

Nikola
Post by Konrad Karpieszuk
Hi people
I think one of most important thing in wordpress is that it supports even
old wordpress api functions (just throwing notice that this is depracated
and you should consider to use new way of doing this thing). This very
important argument when you propose to your customer to build website on
wordpress: you can tell him that website will work for years, and he/she
don't have to be affraid of making wordpress core upgrades.
But this what happens after every upgrade of wordpress which delivers new
version of jQuery i can comment only in three letters: WTF?! :)
Today i upgraded one website of my customer to wp 3.6.1 which brings jquery
1.10. And after that all sliders based on jquery tabs stopped to work.
I found reason: in my sliders i heavily use method 'selected' which in new
version of jQuery is called 'active' and i use 'fx' - now i should use
'show' option.
I changed that, but what with other websites? I developed tens of them
where i am sure problem will be the same after wordpress upgrade.
And also few months ago i sam that jquery tabs method 'rotate' also was
castrated. Then i found some plugin which brought it back.
But this is silly! I include jquery and jquery-ui-tabs using
wp_enqueue_script every time - in the way how codex.wordpress suggest to do
this. Now it looks that because of wp upgrades you cannot depend on this.
I cannot tell my customers not to upgrade wordpress, because of that
animations will stop to work. Also i cannot charge thetm for my additional
work after every wordpress upgarde - this is not the way how i cooperate
with customers.
I know that the problem is in jQuery way of development, not in wordpress,
but maybe you - wordpress core developers - have some idea how to deal with
it?
--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Konrad Karpieszuk
2013-10-09 10:20:24 UTC
Permalink
Nikola, i know how to register own version of jquery, but as you wrote:

"Keep in mind that this might break other plugins that depend
on the latest version of jQuery."

exactly: registering own version o jQ looks like waiting for troubles. i
hate when i see that some plugin developers do this and i see that beacouse
of that wordpress is linking to some cdn with quite old version.

i think wordpress core developers really shouldnt bring cutting edge of
jquery with every minor upgrade of this cms. in php functions support for
old and deprecated is very good, but in javascript looks like horror for
front end developers


--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
Post by Nikola Nikolov
Well a simple solution is to simply register your own version of jQuery and
stick to it. Keep in mind that this might break other plugins that depend
on the latest version of jQuery.
function my_enqueue_scripts() {
// De-register the core version of jQuery
wp_deregister_script( 'jquery' );
// Register our version of jQuery and our script that depends on that
version of jQuery
wp_register_script( 'jquery', get_bloginfo( 'template_directory' ) .
'/js/jquery.js' );
wp_register_script( 'my-jquery-dependent-script', get_bloginfo(
'template_directory' ) . '/js/script.js', array( 'jquery' ) );
// Enqueue the custom script
wp_enqueue_script( 'my-jquery-dependent-script' );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts', 10 );
Now, please keep in mind the following: someone else might come after you
and make changes on the theme, or poke around it. Please leave a note as to
why exactly you're using the exact version of jQuery that you're using, so
that the next person doesn't suffer too much :) And I assume that the
syntax that comes with jQuery 1.10 will stick around for longer, so at
least update your themes to use 1.10 and then use local version of 1.10
Nikola
Post by Konrad Karpieszuk
Hi people
I think one of most important thing in wordpress is that it supports even
old wordpress api functions (just throwing notice that this is depracated
and you should consider to use new way of doing this thing). This very
important argument when you propose to your customer to build website on
wordpress: you can tell him that website will work for years, and he/she
don't have to be affraid of making wordpress core upgrades.
But this what happens after every upgrade of wordpress which delivers new
version of jQuery i can comment only in three letters: WTF?! :)
Today i upgraded one website of my customer to wp 3.6.1 which brings
jquery
Post by Konrad Karpieszuk
1.10. And after that all sliders based on jquery tabs stopped to work.
I found reason: in my sliders i heavily use method 'selected' which in
new
Post by Konrad Karpieszuk
version of jQuery is called 'active' and i use 'fx' - now i should use
'show' option.
I changed that, but what with other websites? I developed tens of them
where i am sure problem will be the same after wordpress upgrade.
And also few months ago i sam that jquery tabs method 'rotate' also was
castrated. Then i found some plugin which brought it back.
But this is silly! I include jquery and jquery-ui-tabs using
wp_enqueue_script every time - in the way how codex.wordpress suggest to
do
Post by Konrad Karpieszuk
this. Now it looks that because of wp upgrades you cannot depend on this.
I cannot tell my customers not to upgrade wordpress, because of that
animations will stop to work. Also i cannot charge thetm for my
additional
Post by Konrad Karpieszuk
work after every wordpress upgarde - this is not the way how i cooperate
with customers.
I know that the problem is in jQuery way of development, not in
wordpress,
Post by Konrad Karpieszuk
but maybe you - wordpress core developers - have some idea how to deal
with
Post by Konrad Karpieszuk
it?
--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Marko Heijnen
2013-10-09 10:40:47 UTC
Permalink
Looking at the jQuery documentation I don't see what you mean. selected() still seems to be fine.
That said. As a developer it's also your task to make sure that all jQuery scripts are updated. Even if a plugin using deprecated functions it doesn't mean you should not update it.

In general I don't think a lot of sites break during a jQuery update. The current one is a more tricky one because of a lot of deprecated functions. Because of the WordPress does load jQuery migrate.
So my feeling saids that the upgrade to jQuery 1.10 was maybe the most tricky upgrade we ever did. And that is not wrong. It just means another step forward. And to me that was needed.

Marko
Post by Konrad Karpieszuk
"Keep in mind that this might break other plugins that depend
on the latest version of jQuery."
exactly: registering own version o jQ looks like waiting for troubles. i
hate when i see that some plugin developers do this and i see that beacouse
of that wordpress is linking to some cdn with quite old version.
i think wordpress core developers really shouldnt bring cutting edge of
jquery with every minor upgrade of this cms. in php functions support for
old and deprecated is very good, but in javascript looks like horror for
front end developers
--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
Post by Nikola Nikolov
Well a simple solution is to simply register your own version of jQuery and
stick to it. Keep in mind that this might break other plugins that depend
on the latest version of jQuery.
function my_enqueue_scripts() {
// De-register the core version of jQuery
wp_deregister_script( 'jquery' );
// Register our version of jQuery and our script that depends on that
version of jQuery
wp_register_script( 'jquery', get_bloginfo( 'template_directory' ) .
'/js/jquery.js' );
wp_register_script( 'my-jquery-dependent-script', get_bloginfo(
'template_directory' ) . '/js/script.js', array( 'jquery' ) );
// Enqueue the custom script
wp_enqueue_script( 'my-jquery-dependent-script' );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts', 10 );
Now, please keep in mind the following: someone else might come after you
and make changes on the theme, or poke around it. Please leave a note as to
why exactly you're using the exact version of jQuery that you're using, so
that the next person doesn't suffer too much :) And I assume that the
syntax that comes with jQuery 1.10 will stick around for longer, so at
least update your themes to use 1.10 and then use local version of 1.10
Nikola
Post by Konrad Karpieszuk
Hi people
I think one of most important thing in wordpress is that it supports even
old wordpress api functions (just throwing notice that this is depracated
and you should consider to use new way of doing this thing). This very
important argument when you propose to your customer to build website on
wordpress: you can tell him that website will work for years, and he/she
don't have to be affraid of making wordpress core upgrades.
But this what happens after every upgrade of wordpress which delivers new
version of jQuery i can comment only in three letters: WTF?! :)
Today i upgraded one website of my customer to wp 3.6.1 which brings
jquery
Post by Konrad Karpieszuk
1.10. And after that all sliders based on jquery tabs stopped to work.
I found reason: in my sliders i heavily use method 'selected' which in
new
Post by Konrad Karpieszuk
version of jQuery is called 'active' and i use 'fx' - now i should use
'show' option.
I changed that, but what with other websites? I developed tens of them
where i am sure problem will be the same after wordpress upgrade.
And also few months ago i sam that jquery tabs method 'rotate' also was
castrated. Then i found some plugin which brought it back.
But this is silly! I include jquery and jquery-ui-tabs using
wp_enqueue_script every time - in the way how codex.wordpress suggest to
do
Post by Konrad Karpieszuk
this. Now it looks that because of wp upgrades you cannot depend on this.
I cannot tell my customers not to upgrade wordpress, because of that
animations will stop to work. Also i cannot charge thetm for my
additional
Post by Konrad Karpieszuk
work after every wordpress upgarde - this is not the way how i cooperate
with customers.
I know that the problem is in jQuery way of development, not in
wordpress,
Post by Konrad Karpieszuk
but maybe you - wordpress core developers - have some idea how to deal
with
Post by Konrad Karpieszuk
it?
--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Konrad Karpieszuk
2013-10-09 13:05:23 UTC
Permalink
Looking at the jQuery documentation I don't see what you mean. selected()
Post by Marko Heijnen
still seems to be fine.
i am not talking about selected() but about this cosntruction:

$('#someDiv').tabs('selected', 1); // to select 2nd tab

which now is


$('#someDiv').tabs('active, 1);


and

$('#someDiv').tabs('option', 'fx', {...}); // to choose transition type
between tabs

which now is

$('#someDiv').tabs('option', 'show', {...});

they just changed names of option. i still dont understand why, what was
wrong with old names, and how bad was that, that now i have to just open
ftp connections to tens of my websites and change those two words. it looks
like some drunk man just did it for fun. and of course i can do this (it
will take a few hours to find every occurencies on every servers witb
wordpress) but i wonder what will be next.

few months ago jquery tabs lost support for option 'rotate', now this...

i really cannot in every half year write email for my customers (some of
them are really big fishes like city halls, music stars) and tell them:
"hey, remember when i told you that wordpress is so trustworthy and stable
platform for website, but you have to remember to upgrade wordpres core and
everything will be fine? i lied, it looks that again they changed something
that wordpress template, which i wrote for you will be broken after cms
upgrade. give me your ftp credentials and i will solve this, or stay with
older, security risk version" ;)
Marko Heijnen
2013-10-09 13:20:32 UTC
Permalink
Ah okay. That has nothing to do with jQuery but with jQuery UI. What are two different things.
From there I can see what you mean. After reading http://jqueryui.com/upgrade-guide/1.9/ I see that they did change a lot of things and I can understand you now.

I do have to say that all the breakage could have been prevented because the changes you described happened already in the jQuery UI version of WordPress 3.5. in jQuery UI 1.9.
The deprecated functions got removed in WordPress 3.6 because of jQuery UI 1.10. Maybe we should have waited to upgrade jQuery UI until 3.7 or 3.8 but I guess in both situation your slider would have been broken then.

I can understand how you feel in this situation but using external libraries isn't always easy. WordPress can't prevent those changes in jQuery UI, so we also test it really well if we upgrade it.

Marko
Post by Marko Heijnen
Looking at the jQuery documentation I don't see what you mean. selected()
Post by Marko Heijnen
still seems to be fine.
$('#someDiv').tabs('selected', 1); // to select 2nd tab
which now is
$('#someDiv').tabs('active, 1);
and
$('#someDiv').tabs('option', 'fx', {...}); // to choose transition type
between tabs
which now is
$('#someDiv').tabs('option', 'show', {...});
they just changed names of option. i still dont understand why, what was
wrong with old names, and how bad was that, that now i have to just open
ftp connections to tens of my websites and change those two words. it looks
like some drunk man just did it for fun. and of course i can do this (it
will take a few hours to find every occurencies on every servers witb
wordpress) but i wonder what will be next.
few months ago jquery tabs lost support for option 'rotate', now this...
i really cannot in every half year write email for my customers (some of
"hey, remember when i told you that wordpress is so trustworthy and stable
platform for website, but you have to remember to upgrade wordpres core and
everything will be fine? i lied, it looks that again they changed something
that wordpress template, which i wrote for you will be broken after cms
upgrade. give me your ftp credentials and i will solve this, or stay with
older, security risk version" ;)
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Konrad Karpieszuk
2013-10-09 15:58:31 UTC
Permalink
ok, thank you for this answer, really!

but what can i do now? i still have some websites not upgraded and now i
know that when i do this, this will break .tabs() on them. i see two
solution:

- upgrade and change theme code (all occurencies of 'selected into
'active'), this will take me a lot of time

- create plugin with .js which will add those things. but... i dont know
how :) can anyone give me a tip how to add option to .tabs() which will
just delegate things to new one? i know it is not wordpress question, but
maybe somebody know exact link to help



--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
Post by Marko Heijnen
Ah okay. That has nothing to do with jQuery but with jQuery UI. What are
two different things.
From there I can see what you mean. After reading
http://jqueryui.com/upgrade-guide/1.9/ I see that they did change a lot
of things and I can understand you now.
I do have to say that all the breakage could have been prevented because
the changes you described happened already in the jQuery UI version of
WordPress 3.5. in jQuery UI 1.9.
The deprecated functions got removed in WordPress 3.6 because of jQuery UI
1.10. Maybe we should have waited to upgrade jQuery UI until 3.7 or 3.8 but
I guess in both situation your slider would have been broken then.
I can understand how you feel in this situation but using external
libraries isn't always easy. WordPress can't prevent those changes in
jQuery UI, so we also test it really well if we upgrade it.
Marko
Post by Marko Heijnen
Looking at the jQuery documentation I don't see what you mean.
selected()
Post by Marko Heijnen
Post by Marko Heijnen
still seems to be fine.
$('#someDiv').tabs('selected', 1); // to select 2nd tab
which now is
$('#someDiv').tabs('active, 1);
and
$('#someDiv').tabs('option', 'fx', {...}); // to choose transition type
between tabs
which now is
$('#someDiv').tabs('option', 'show', {...});
they just changed names of option. i still dont understand why, what was
wrong with old names, and how bad was that, that now i have to just open
ftp connections to tens of my websites and change those two words. it
looks
Post by Marko Heijnen
like some drunk man just did it for fun. and of course i can do this (it
will take a few hours to find every occurencies on every servers witb
wordpress) but i wonder what will be next.
few months ago jquery tabs lost support for option 'rotate', now this...
i really cannot in every half year write email for my customers (some of
"hey, remember when i told you that wordpress is so trustworthy and
stable
Post by Marko Heijnen
platform for website, but you have to remember to upgrade wordpres core
and
Post by Marko Heijnen
everything will be fine? i lied, it looks that again they changed
something
Post by Marko Heijnen
that wordpress template, which i wrote for you will be broken after cms
upgrade. give me your ftp credentials and i will solve this, or stay with
older, security risk version" ;)
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Marko Heijnen
2013-10-09 17:40:27 UTC
Permalink
In the current case you can already update the code if the site is on WordPress 3.5 since that has already the new naming.
The second thing I can't help you out with. You can look at the link I send you earlier for the rotate code. Maybe that one is helpful.

Marko
Post by Konrad Karpieszuk
ok, thank you for this answer, really!
but what can i do now? i still have some websites not upgraded and now i
know that when i do this, this will break .tabs() on them. i see two
- upgrade and change theme code (all occurencies of 'selected into
'active'), this will take me a lot of time
- create plugin with .js which will add those things. but... i dont know
how :) can anyone give me a tip how to add option to .tabs() which will
just delegate things to new one? i know it is not wordpress question, but
maybe somebody know exact link to help
--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski
Post by Marko Heijnen
Ah okay. That has nothing to do with jQuery but with jQuery UI. What are
two different things.
From there I can see what you mean. After reading
http://jqueryui.com/upgrade-guide/1.9/ I see that they did change a lot
of things and I can understand you now.
I do have to say that all the breakage could have been prevented because
the changes you described happened already in the jQuery UI version of
WordPress 3.5. in jQuery UI 1.9.
The deprecated functions got removed in WordPress 3.6 because of jQuery UI
1.10. Maybe we should have waited to upgrade jQuery UI until 3.7 or 3.8 but
I guess in both situation your slider would have been broken then.
I can understand how you feel in this situation but using external
libraries isn't always easy. WordPress can't prevent those changes in
jQuery UI, so we also test it really well if we upgrade it.
Marko
Post by Marko Heijnen
Looking at the jQuery documentation I don't see what you mean.
selected()
Post by Marko Heijnen
Post by Marko Heijnen
still seems to be fine.
$('#someDiv').tabs('selected', 1); // to select 2nd tab
which now is
$('#someDiv').tabs('active, 1);
and
$('#someDiv').tabs('option', 'fx', {...}); // to choose transition type
between tabs
which now is
$('#someDiv').tabs('option', 'show', {...});
they just changed names of option. i still dont understand why, what was
wrong with old names, and how bad was that, that now i have to just open
ftp connections to tens of my websites and change those two words. it
looks
Post by Marko Heijnen
like some drunk man just did it for fun. and of course i can do this (it
will take a few hours to find every occurencies on every servers witb
wordpress) but i wonder what will be next.
few months ago jquery tabs lost support for option 'rotate', now this...
i really cannot in every half year write email for my customers (some of
"hey, remember when i told you that wordpress is so trustworthy and
stable
Post by Marko Heijnen
platform for website, but you have to remember to upgrade wordpres core
and
Post by Marko Heijnen
everything will be fine? i lied, it looks that again they changed
something
Post by Marko Heijnen
that wordpress template, which i wrote for you will be broken after cms
upgrade. give me your ftp credentials and i will solve this, or stay with
older, security risk version" ;)
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...