Opened 9 years ago

Closed 9 years ago

#14291 closed defect (invalid)

[patch][ccla] base theme in themeMap

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

Description (last modified by Adam Peller)

I am defining a custom themeMap[["Android",null,["../themes/custom/custom.css"]],["BlackBerry",null,["../themes/custom/custom.css"]],["iPad",null,["../themes/custom/custom.css"]],["iPhone",null,["../themes/custom/custom.css"]],[".*",null,["../themes/custom/custom.css"]]];

I do not want a base theme added to the head but expects a base, deviceTheme adds a link to

<link href="../../../dojox/mobile/themes/null/null.css" type="text/css" rel="stylesheet">

it would be nice if loadDeviceTheme would check the base theme for null before adding it to the head to prevent a 404 error

I have attached a html file with the test case and a example that has been patched

Attachments (2)

my_test_iPhone-Heading.html (2.2 KB) - added by Bill Reed 9 years ago.
html test case
deviceTheme.js (6.0 KB) - added by Bill Reed 9 years ago.
proposed fix

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by Bill Reed

Attachment: my_test_iPhone-Heading.html added

html test case

Changed 9 years ago by Bill Reed

Attachment: deviceTheme.js added

proposed fix

comment:1 Changed 9 years ago by Adam Peller

Cc: Adam Peller added
Description: modified (diff)
Milestone: tbd

comment:2 Changed 9 years ago by Adam Peller

Summary: base theme in themeMap[patch][ccla] base theme in themeMap

comment:3 Changed 9 years ago by ykami

I do not think defining a theme folder name as null makes sense because this module is a theme loader. How about setting to []? That should prevent deviceTheme to load a base theme file.

comment:4 Changed 9 years ago by Bill Reed

If the user wants to override the default themeMap with a custom themeMap for devices the user can define a themeMap as:[["Android",null,["../themes/custom/mydroid.css"]],["BlackBerry",null,["../themes/custom/custom.css"]],["iPad",null,["../themes/custom/custom.css"]],["iPhone",null,["../themes/custom/myPhone.css"]],[".*",null,["../themes/custom/custom.css"]]];

If the user defines a base theme[["Android","android",["../themes/custom/mydroid.css"]],["BlackBerry","blackberry",["../themes/custom/custom.css"]],["iPad",null,["../themes/custom/custom.css"]],["iPhone",null,["../themes/custom/myPhone.css"]],[".*",null,["../themes/custom/custom.css"]]];

That base theme is also loaded, if the user has decided to remove a css rule in their myAndroid.css theme the through css cascade the css rule from the base theme will still be used. This is not the result that the user was after.

So by not defining a base theme for a device, deviceTheme will not load the theme and only load the theme specified in the themeMap.

I tried your suggestion:[["Android",[],["../themes/custom/mydroid.css"]],["BlackBerry",[],["../themes/custom/custom.css"]],["iPad",[],["../themes/custom/custom.css"]],["iPhone",[],["../themes/custom/myPhone.css"]],[".*",[],["../themes/custom/custom.css"]]];

And I still see this in the console:

GET file:///C:/workspace_helious_64/all/dojox/mobile/themes//.css

comment:5 Changed 9 years ago by ykami

I meant to [], not Its default value is [ "@theme" ]. And "@theme" means a base theme file for a detected device such as iphone.css. Please see the inline doc for details.

comment:6 Changed 9 years ago by Bill Reed

Thanks, that does the job...

require(["dojox/mobile"],function(dojoxMobile){dojoxMobile.themeMap=[["Android","",["themes/custom/custom.css"]],["BlackBerry","",["themes/custom/custom.css"]],["iPad","",["themes/custom/custom.css"]],["iPhone","",["themes/custom/custom.css"]],[".*","",["themes/custom/custom.css"]]];dojoxMobile.themeFiles = [];});

comment:7 Changed 9 years ago by ykami

Milestone: tbd1.8
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.