#13916 closed defect (fixed)
[patch][ccla]Allow control of theme selection in deviceThemes.loadDeviceTheme
Reported by: | Adam Peller | Owned by: | ykami |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | DojoX Mobile | Version: | 1.6.1 |
Keywords: | Cc: | [email protected]…, [email protected]…, [email protected]…, [email protected]… | |
Blocked By: | Blocking: |
Description (last modified by )
In Maqetta, we need to be able to simulate output for a given device, so when loading a dojox.mobile app, we wish to override the default behavior which picks a theme based on the userAgent string. Proposed solution: add config.mblUserAgent
Also, we wish to change the theme files on the fly after the code has loaded. Proposed solution: add an argument to loadDeviceTheme
We can already track which CSS files are loaded by adding advice to the loadCSSFile method, then removing those stylesheets from the DOM ourselves before calling loadDevice theme a second time with a different argument. The alternative would be asking loadThemeDevice to remember and remove old theme files for us.
Two less critical concerns: 1) loadDeviceTheme seems to accumulate files if called repeatedly; rather than just adding iphone.css, it will add several copies. 2) the _compat code overrides loadCssFile, so depending on the order in which it's loaded, it may clobber our dojo.connect to the method
Sorry for the last minute request...
Attachments (2)
Change History (7)
Changed 9 years ago by
Attachment: | deviceTheme.patch added |
---|
Changed 9 years ago by
Attachment: | _compat.patch added |
---|
conditionally redefine loadCssFile (doesn't really solve our problem, but just a suggestion) and fix indentation
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 9 years ago by
then removing those stylesheets from the DOM ourselves before calling loadDevice theme a second time
Yes, that is necessary. We once had theme name prefixes, such as .iphone, for all the css selectors, but we removed them to reduce the code size. So you cannot load two different themes at the same time.
comment:5 Changed 9 years ago by
Sorry about that. I had assumed deviceThemes was loaded in my testing. Will have to find another way to hook loadCSSFile, since it's getting redefined by compat.
support config.mblUserAgent, add arg to loadDeviceTheme