Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[css] reordered view registration to make sure of order: view class s…

…electors, css class selectors, and id selectors
  • Loading branch information...
commit dc990f310d26332f2daaced571970f990392dbc5 1 parent fb98ec7
Max Metral authored
Showing with 8 additions and 10 deletions.
  1. +8 −10 src/css/src/NIDOM.m
View
18 src/css/src/NIDOM.m
@@ -153,6 +153,9 @@ - (void)registerView:(UIView *)view {
- (void)registerView:(UIView *)view withCSSClass:(NSString *)cssClass andId:(NSString *)viewId
{
+ // These are basically the least specific selectors (by our simple rules), so this needs to get registered first
+ [self registerView:view withCSSClass:cssClass];
+
NSArray *pseudos = nil;
if (viewId) {
if (![viewId hasPrefix:@"#"]) { viewId = [@"#" stringByAppendingString:viewId]; }
@@ -172,21 +175,16 @@ - (void)registerView:(UIView *)view withCSSClass:(NSString *)cssClass andId:(NSS
}
}
}
- }
- [self registerView:view withCSSClass:cssClass];
-
- if (viewId) {
+
if (!_idToViewMap) {
_idToViewMap = [[NSMutableDictionary alloc] init];
}
[_idToViewMap setObject:view forKey:viewId];
// Run the id selectors last so they take precedence
- if (viewId) {
- [self refreshStyleForView:view withSelectorName:viewId];
- if (pseudos) {
- for (NSString *ps in pseudos) {
- [self refreshStyleForView:view withSelectorName:[viewId stringByAppendingString:ps]];
- }
+ [self refreshStyleForView:view withSelectorName:viewId];
+ if (pseudos) {
+ for (NSString *ps in pseudos) {
+ [self refreshStyleForView:view withSelectorName:[viewId stringByAppendingString:ps]];
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.