[TIMOB-3143] iOS: jss className does not override label
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-16T11:03:13.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | Release 1.7.0, Sprint 2011-15 |
Components | iOS |
Labels | defect, ios, klist, release-1.7.0, reported-1.6.0, rplist |
Reporter | Jon Alter |
Assignee | Jacob Relkin |
Created | 2011-04-15T03:37:58.000+0000 |
Updated | 2011-05-16T11:03:13.000+0000 |
Description
When using a jss the className does not take priority over the
label name as it should.
Example:
app.js
Titanium.UI.setBackgroundColor('#000');
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var normalLabel = Ti.UI.createLabel({
text: 'Normal label!',
textAlign: 'center',
width: 'auto',
top: 50
});
var redLabel = Ti.UI.createLabel({
text: 'Red label!',
textAlign: 'center',
width: 'auto',
top: 100,
className: 'red'
});
win.add(normalLabel);
win.add(redLabel);
win.open();
app.jss
label{
color: 'blue';
}
.red {
font-weight: 'bold';
color: 'red';
}
Expected: normalLabel to be blue and redLabel to be red
Actual: both labels are blue
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/72821">http://developer.appcelerator.com/helpdesk/view/72821
Okay, here goes:
When we compile the CSS into a plist, we create four dictionaries: "ids" and "classes", and corresponding dicts with those names appended with "density".
The compiler apparently merges tag selectors and classes into the "classes" dictionary, while the ids are kept separate as they should be.
So, in our code, we're iterating over the classes first, then the ids to maintain priority. Works great, right? Nope.
Since we're iterating over the classes first, which are already merged together with the tag selectors, we lose the precedence that the classes have over the tag selectors.
Also, an interesting test case is to try using a class name like ".label" - this will act exactly as a tag selector would - apply the style to all TiUILabels because of the aforementioned merging of the dictionaries!
I have added sub-types of Release type in Task Type field. Can you pick specific sub-type to unbind 'Release' type, please ?.
Tested with 1.7.0.879871b...(05/10/11 19:34) on iPod 3rd Gen (4.0.1) and Sim (4.1)