jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.7k stars 2.41k forks source link

tabs cause error if `history.pushState` has been called #8630

Open pstanton opened 5 years ago

pstanton commented 5 years ago

i have a tab component which i'm creating via $(container).trigger("create"); after I have previously used history.pushState to pretty up my page's address. When the tabs component within the container is creating itself, it seems to trigger an xhr request to the current page's url for some unknown reason. This in turn causes all of the scripts in the page to be "eval'd" which throws an error and breaks my whole page.

stack of unexpected xhr request:

send (jquery-2.2.4.js:9064)
ajax (jquery-2.2.4.js:8656)
load (jquery.mobile-1.4.5.js:15186)
(anonymous) (jquery.mobile-1.4.5.js:835)
_create (jquery.mobile-1.4.5.js:14493)
(anonymous) (jquery.mobile-1.4.5.js:835)
_createWidget (jquery.mobile-1.4.5.js:1000)
$.(anonymous function).(anonymous function) (jquery.mobile-1.4.5.js:796)
(anonymous) (jquery.mobile-1.4.5.js:947)
each (jquery-2.2.4.js:365)
each (jquery-2.2.4.js:137)
$.fn.(anonymous function) (jquery.mobile-1.4.5.js:942)
enhanceWithin (jquery.mobile-1.4.5.js:602)
(anonymous) (jquery.mobile-1.4.5.js:4417)
dispatch (jquery-2.2.4.js:4737)
elemData.handle (jquery-2.2.4.js:4549)
trigger (jquery-2.2.4.js:7807)
(anonymous) (jquery-2.2.4.js:7875)
each (jquery-2.2.4.js:365)
each (jquery-2.2.4.js:137)
trigger (jquery-2.2.4.js:7874)
show (landing.js?v=44:58) <-- my code

If I take out my call to history.pushState, or my tabs component it all works again.