Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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: billreed@…, pedemont@…, jferrai@…, chrism1@…
Blocked By: Blocking:

Description (last modified by Adam Peller)

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)

deviceTheme.patch (1.5 KB) - added by Adam Peller 8 years ago.
support config.mblUserAgent, add arg to loadDeviceTheme
_compat.patch (1.6 KB) - added by Adam Peller 8 years ago.
conditionally redefine loadCssFile (doesn't really solve our problem, but just a suggestion) and fix indentation

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Adam Peller

Attachment: deviceTheme.patch added

support config.mblUserAgent, add arg to loadDeviceTheme

Changed 8 years ago by Adam Peller

Attachment: _compat.patch added

conditionally redefine loadCssFile (doesn't really solve our problem, but just a suggestion) and fix indentation

comment:1 Changed 8 years ago by Adam Peller

Description: modified (diff)

comment:2 Changed 8 years ago by ykami

Resolution: fixed
Status: newclosed

In [26583]:

Fixes #13916 !strict. Added support for config.mblUserAgent and a new arg 'userAgent' for loadDeviceThme to override the default behavior.

comment:3 Changed 8 years ago by ykami

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:4 Changed 8 years ago by ykami

In [26595]:

Refs #13916 !strict Reverted the changes to _compat.js, since it broke the compat support on FF as reported in #13905.

comment:5 Changed 8 years ago by Adam Peller

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.

Note: See TracTickets for help on using tickets.