jquery-mobilewebshim

Webshim calendar gets weird in "multi page template" Jqm


Nothing can explain better then fiddle: www.jsfiddle.net/Dt2TE/15/

Compare with where their isn't any multie page view. www.jsfiddle.net/Dt2TE/9/ There is some JS that doesn't get properly loaded into the other page (#two).


Solution

  • jQuery mobile needs to initialized before webshims, otherwise you get exactly this result. As I wrote the jQm compatibility things, I wasn't aware, that jQM can have multiple pages in one document and only enhances one of them.

    I needed to change some parts in polyfiller to support this. Here are the changes: https://github.com/aFarkas/webshim/commit/03b425a2258a8c168c165dbde58ec3a09ae76433

    A working example can be seen here: http://afarkas.github.io/webshim/demos/demos/webforms/jquery-mobile.html

    And here an updated fiddle: http://jsfiddle.net/trixta/Dt2TE/31/

    //jQM: set waitReady to false
    webshims.setOptions('waitReady', false);        
    
    //jQM: set wsdoc to active page or false
    webshims.setOptions('wsdoc', $('.ui-page-active').updatePolyfill().get(0) || false);
    
    //jQM: update polyfills on pageinit and change active page
    $(document).on('pageinit', function(e){
        webshims.setOptions('wsdoc', e.target);
        $(e.target).updatePolyfill();
    });