Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13986 closed defect (fixed)

Using dojox.mobile.deviceTheme.loadDeviceTheme('Android') does not load -compat.css

Reported by: Bill Reed Owned by: ykami
Priority: high Milestone: 1.7
Component: DojoX Mobile Version: 1.7.0b1
Keywords: Cc: Adam Peller
Blocked By: Blocking:

Description

When using dojox.mobile.deviceTheme.loadDeviceTheme('Android') to switch mobile themes at runtime on firefox the theme is switched from iphone (the default at load time) to Android the android.css file is added to the head but the corresponding android-compt.css is not. Also the previous theme css files are left in the head.

I have attached a html file that reproduces the problem as well as updated dojox.mobile.deviceTheme.js and dojox.mobile._compat.js that fix both the removing of old theme css files and the loading of -compat.css files

Attachments (5)

my_ test_Custom-Heading.html (2.2 KB) - added by Bill Reed 8 years ago.
html file to switch themes at runtime
deviceTheme.js (6.0 KB) - added by Bill Reed 8 years ago.
proposed fix
_compat.js (15.6 KB) - added by Bill Reed 8 years ago.
proposed fix
_compat.js.patch (854 bytes) - added by Bill Reed 8 years ago.
patch file
deviceTheme.js.patch (1.4 KB) - added by Bill Reed 8 years ago.
patch file

Download all attachments as: .zip

Change History (12)

Changed 8 years ago by Bill Reed

html file to switch themes at runtime

Changed 8 years ago by Bill Reed

Attachment: deviceTheme.js added

proposed fix

Changed 8 years ago by Bill Reed

Attachment: _compat.js added

proposed fix

comment:1 Changed 8 years ago by Adam Peller

Cc: Adam Peller added

Changed 8 years ago by Bill Reed

Attachment: _compat.js.patch added

patch file

Changed 8 years ago by Bill Reed

Attachment: deviceTheme.js.patch added

patch file

comment:2 Changed 8 years ago by ykami

Thank you for the patch. But we need to think about if it is really a useful and necessary feature in general. Also, it looks the patch needs some rework. And I think you should be able to manage by yourself without it.

comment:3 Changed 8 years ago by Bill Reed

The patch was only a example of a solution, I will rework the solution if you would like. The issue I am attempting to address is we have a requirement in Maqetta.org to support users developing and deploying custom mobile theme's The design approach we have selected is to leverage dojox.mobile.deviceTheme We would add a line of code to the user's html file to change the dojox.mobile.themeMap to include the users css theme file. For example

dojox.mobile.themeMap=Android","android",["myandroid.css?,["BlackBerry?","blackberry",mybb.css?],["iPad","iphone",[require.toUrl("dojox/mobile/themes/iphone/ipad.css")]],["Custom","custom",[]],["mobile3","",themes/mobile3/mobile3.css?],[".*","iphone",iphone.css?]];

Currently we have code that connect's to the loadDeviceTheme and keeps track of the css files loaded, and removes theme. But we will need to duplicated that code in multiple places in maqetta as well as possible forcing the user to add the code to every html where they would like to do dynamic theme switching. Which would not be that uncommon when mocking up a UI. Moving the code for removing old theme files into deviceTheme seems to only be logical, since code has been added to allow user's of deviceTheme (loadDeviceTheme(ua) to dynamically switch theme's.

comment:4 Changed 8 years ago by ykami

ok, I understand your motivation and requirement, but the patch doesn't look good. I will try implementing your requirement with minimum code size increase.

comment:5 Changed 8 years ago by Bill Reed

Cool! Thanks.

comment:6 Changed 8 years ago by ykami

Resolution: fixed
Status: newclosed

In [26692]:

Fixes #13986 !strict. In loadDeviceTheme(), remove already loaded css files before loading the new ones, and load compat css files when in the compat mode.

comment:7 Changed 8 years ago by Adam Peller

Milestone: tbd1.7
Note: See TracTickets for help on using tickets.