Steps to Reproduce:
- Check "Show previews without reloading the page" in Preferences -> Editing
- Open a CSS or JavaScript in the User namespace that you can edit, e.g. Special:MyPage/common.css
- Click "Show preview" – the page reloads
- Click "Show preview" again
Actual Results:
- Only the preview area, not the entire page, reloads, without executing the new code.
Expected Results:
- The entire page reloads just like the first time, with the new CSS/JS code executed.
It looks like this is because mediawiki.action.edit.preview.js looks for #mw-userjsyoucanpreview and #mw-usercssyoucanpreview, which only appear in the first preview. I believe this can be solved by instead seeing if mw.config.get( 'wgNamespaceNumber' ) returns 2 and if mw.config.get( 'wgPageContentModel' ) returns css or javascript.