Dynamic page theme swatch don't work properly

Dynamic page theme swatch don't work properly

Hello,
first of all I apologize for my bad english.
I'm trying to dinamically change the page theme with the function found in the jquery mobile API documentation.

The function is like that:
$('[data-role="page"]).page( 'option', 'theme', 'b' );

If i run this function several times with different swatch themes, it add the page css class theme for each swatch instead of switch it.

Example:
I load the page with default theme.
It add  in the page class:
ui-page-theme-a
Then i execute:
  1. $('[data-role="page"]).page( 'option', 'theme', 'b' );
      It add:
ui-page-theme-b
      And remove:
ui-page-theme-a
Then i execute:
  1. $('[data-role="page"]).page( 'option', 'theme', 'a' );
      It add:
ui-page-theme-a
      But  do not remove:
ui-page-theme-b

I don't know if this is the normal behavior (or happen only in my case) so I ask for clarification on this and in case this is the normal use, how to "emulate" a switch behavior ( JQuery mobile 1.4.5)


thanks