mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Fixed: Make sure we handle undefined when testing for nil values (#2862)
This commit is contained in:
@@ -271,7 +271,7 @@
|
||||
if (_disableSetContent)
|
||||
return;
|
||||
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
value = [];
|
||||
|
||||
if (![value isKindOfClass:[CPArray class]])
|
||||
@@ -754,7 +754,7 @@
|
||||
_filterPredicate = nil;
|
||||
[self _rearrangeObjects];
|
||||
}
|
||||
else if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
|
||||
else if (_filterPredicate == nil || [_filterPredicate evaluateWithObject:object])
|
||||
{
|
||||
// Insert directly into the array.
|
||||
var pos = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors];
|
||||
@@ -767,7 +767,7 @@
|
||||
[_selectionIndexes shiftIndexesStartingAtIndex:pos by:1];
|
||||
}
|
||||
/*
|
||||
else if (_filterPredicate !== nil)
|
||||
else if (_filterPredicate != nil)
|
||||
...
|
||||
// Implies _filterPredicate && ![_filterPredicate evaluateWithObject:object], so the new object does
|
||||
// not appear in arrangedObjects and we do not have to update at all.
|
||||
@@ -867,7 +867,7 @@
|
||||
|
||||
_disableSetContent = NO;
|
||||
|
||||
if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
|
||||
if (_filterPredicate == nil || [_filterPredicate evaluateWithObject:object])
|
||||
{
|
||||
// selectionIndexes change notification will be fired as a result of the
|
||||
// content change. Don't fire manually.
|
||||
|
||||
+1
-1
@@ -807,7 +807,7 @@ CPButtonImageOffset = 3.0;
|
||||
{
|
||||
var selfWindow = [self window];
|
||||
|
||||
if (selfWindow === aWindow || aWindow === nil)
|
||||
if (selfWindow === aWindow || aWindow == nil)
|
||||
return;
|
||||
|
||||
if ([selfWindow defaultButton] === self)
|
||||
|
||||
@@ -739,7 +739,7 @@ var HORIZONTAL_MARGIN = 2;
|
||||
*/
|
||||
- (void)setMinItemSize:(CGSize)aSize
|
||||
{
|
||||
if (aSize === nil || aSize === undefined)
|
||||
if (aSize == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:"Invalid value provided for minimum size"];
|
||||
|
||||
if (CGSizeEqualToSize(_minItemSize, aSize))
|
||||
|
||||
+1
-1
@@ -564,7 +564,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
var selectedStringValue = [_listDelegate selectedStringValue];
|
||||
|
||||
if (selectedStringValue === nil)
|
||||
if (selectedStringValue == nil)
|
||||
return NO;
|
||||
else
|
||||
_selectedStringValue = selectedStringValue;
|
||||
|
||||
+8
-8
@@ -622,15 +622,15 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
*/
|
||||
- (CPString)stringValue
|
||||
{
|
||||
if (_formatter && _value !== undefined)
|
||||
if (_formatter && _value != nil)
|
||||
{
|
||||
var formattedValue = [self hasThemeState:CPThemeStateEditing] ? [_formatter editingStringForObjectValue:_value] : [_formatter stringForObjectValue:_value];
|
||||
|
||||
if (formattedValue !== nil && formattedValue !== undefined)
|
||||
if (formattedValue != nil)
|
||||
return formattedValue;
|
||||
}
|
||||
|
||||
return (_value === undefined || _value === nil) ? @"" : String(_value);
|
||||
return _value == nil ? @"" : String(_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -639,7 +639,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
- (void)setStringValue:(CPString)aString
|
||||
{
|
||||
// Cocoa raises an invalid parameter assertion and returns if you pass nil.
|
||||
if (aString === nil || aString === undefined)
|
||||
if (aString == nil)
|
||||
{
|
||||
CPLog.warn("nil or undefined sent to CPControl -setStringValue");
|
||||
return;
|
||||
@@ -1137,18 +1137,18 @@ var CPControlActionKey = @"CPControlActionKey",
|
||||
|
||||
var objectValue = [self objectValue];
|
||||
|
||||
if (objectValue !== nil)
|
||||
if (objectValue != nil)
|
||||
[aCoder encodeObject:objectValue forKey:CPControlValueKey];
|
||||
|
||||
if (_target !== nil)
|
||||
if (_target != nil)
|
||||
[aCoder encodeConditionalObject:_target forKey:CPControlTargetKey];
|
||||
|
||||
if (_action !== nil)
|
||||
if (_action != nil)
|
||||
[aCoder encodeObject:_action forKey:CPControlActionKey];
|
||||
|
||||
[aCoder encodeInt:_sendActionOn forKey:CPControlSendActionOnKey];
|
||||
|
||||
if (_formatter !== nil)
|
||||
if (_formatter != nil)
|
||||
[aCoder encodeObject:_formatter forKey:CPControlFormatterKey];
|
||||
|
||||
[aCoder encodeInt:_controlSize forKey:CPControlControlSizeKey];
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
aNewObject._controller = self;
|
||||
aNewObject._key = aKey;
|
||||
|
||||
if (aValue !== nil)
|
||||
if (aValue != nil)
|
||||
[aNewObject setValue:aValue];
|
||||
|
||||
return aNewObject;
|
||||
@@ -98,7 +98,7 @@
|
||||
var iter = [[CPSet setWithArray:allKeys] objectEnumerator],
|
||||
obj;
|
||||
|
||||
while ((obj = [iter nextObject]) !== nil)
|
||||
while ((obj = [iter nextObject]) != nil)
|
||||
if (![_excludedKeys containsObject:obj])
|
||||
[array addObject:[self _newObjectWithKey:obj value:nil]];
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ var CPSharedDocumentController = nil;
|
||||
var iter = [_documents objectEnumerator],
|
||||
obj;
|
||||
|
||||
while ((obj = [iter nextObject]) !== nil)
|
||||
while ((obj = [iter nextObject]) != nil)
|
||||
{
|
||||
if ([obj isDocumentEdited])
|
||||
return YES;
|
||||
|
||||
+1
-1
@@ -608,7 +608,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
*/
|
||||
+ (void)stopPeriodicEvents
|
||||
{
|
||||
if (_CPEventPeriodicEventTimer === nil)
|
||||
if (_CPEventPeriodicEventTimer == nil)
|
||||
return;
|
||||
|
||||
window.clearTimeout(_CPEventPeriodicEventTimer);
|
||||
|
||||
@@ -145,7 +145,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
|
||||
var enumerator = [_params keyEnumerator],
|
||||
key;
|
||||
|
||||
while (_DOMObjectElement && (key = [enumerator nextObject]) !== nil)
|
||||
while (_DOMObjectElement && (key = [enumerator nextObject]) != nil)
|
||||
{
|
||||
var param = document.createElement(@"param");
|
||||
param.name = key;
|
||||
@@ -177,7 +177,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
|
||||
paramEnumerator = [_params keyEnumerator],
|
||||
key;
|
||||
|
||||
while ((key = [paramEnumerator nextObject]) !== nil)
|
||||
while ((key = [paramEnumerator nextObject]) != nil)
|
||||
paramString = [paramString stringByAppendingFormat:@"<param name='%@' value='%@' />", key, [_params objectForKey:key]];
|
||||
|
||||
_DOMObjectElement = document.createElement(@"object");
|
||||
|
||||
@@ -207,7 +207,7 @@ CPRemoveTraitFontAction = 7;
|
||||
- (@action)addFontTrait:(id)sender
|
||||
{
|
||||
var tag = [sender tag];
|
||||
_activeChange = tag === nil ? @{} : @{ @"addTraits": tag };
|
||||
_activeChange = tag == nil ? @{} : @{ @"addTraits": tag };
|
||||
_fontAction = CPAddTraitFontAction;
|
||||
|
||||
[self sendAction];
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ function CPImageInBundle()
|
||||
|
||||
if (typeof(arguments[1]) === "number")
|
||||
{
|
||||
if (arguments[1] !== nil && arguments[1] !== undefined)
|
||||
if (arguments[1] != nil)
|
||||
size = CGSizeMake(arguments[1], arguments[2]);
|
||||
|
||||
bundle = arguments[3];
|
||||
@@ -161,7 +161,7 @@ function CPAppKitImage(aFilename, aSize)
|
||||
- (id)initByReferencingFile:(CPString)aFilename size:(CGSize)aSize
|
||||
{
|
||||
// Quietly return nil like in Cocoa, rather than crashing later.
|
||||
if (aFilename === undefined || aFilename === nil)
|
||||
if (aFilename == nil)
|
||||
return nil;
|
||||
|
||||
self = [super init];
|
||||
|
||||
@@ -293,7 +293,7 @@ var CPBindingOperationAnd = 0,
|
||||
// If the value is nil AND the source doesn't respond to setPlaceholderString: then
|
||||
// we set the value to the placeholder. Otherwise, we do not want to short cut the process
|
||||
// of setting the placeholder that is based on the fact that the value is nil.
|
||||
if ((aValue === undefined || aValue === nil || aValue === [CPNull null])
|
||||
if ((aValue == nil || aValue === [CPNull null])
|
||||
&& ![_source respondsToSelector:@selector(setPlaceholderString:)])
|
||||
aValue = [options objectForKey:CPNullPlaceholderBindingOption] || nil;
|
||||
|
||||
@@ -653,7 +653,7 @@ var CPBindingOperationAnd = 0,
|
||||
keyPath = [info objectForKey:CPObservedKeyPathKey],
|
||||
value = [object valueForKeyPath:keyPath];
|
||||
|
||||
if (value === nil || value === undefined)
|
||||
if (value == nil)
|
||||
{
|
||||
[_source setEnabled:NO];
|
||||
return;
|
||||
@@ -796,7 +796,7 @@ var CPBindingOperationAnd = 0,
|
||||
else
|
||||
value = [theBinding transformValue:value withOptions:options];
|
||||
|
||||
if (value === nil || value === undefined)
|
||||
if (value == nil)
|
||||
value = @"";
|
||||
|
||||
result.value = result.value.replace("%{" + _patternPlaceholder + count + "}@", [value description]);
|
||||
|
||||
@@ -164,7 +164,7 @@ var _CPMenuBarVisible = NO,
|
||||
|
||||
+ (void)_setOrRemoveMenuBarAttribute:(id)aValue forKey:(id)aKey
|
||||
{
|
||||
if (aValue === nil)
|
||||
if (aValue == nil)
|
||||
[_CPMenuBarAttributes removeObjectForKey:aKey];
|
||||
else
|
||||
[_CPMenuBarAttributes setObject:aValue forKey:aKey];
|
||||
|
||||
@@ -553,7 +553,7 @@ var STICKY_TIME_INTERVAL = 0.4,
|
||||
var iter = [selectorNames objectEnumerator],
|
||||
obj;
|
||||
|
||||
while ((obj = [iter nextObject]) !== nil)
|
||||
while ((obj = [iter nextObject]) != nil)
|
||||
{
|
||||
var aSelector = CPSelectorFromString(obj);
|
||||
|
||||
@@ -587,7 +587,7 @@ var STICKY_TIME_INTERVAL = 0.4,
|
||||
var iter = [[menu itemArray] objectEnumerator],
|
||||
obj;
|
||||
|
||||
while ((obj = [iter nextObject]) !== nil)
|
||||
while ((obj = [iter nextObject]) != nil)
|
||||
{
|
||||
if ([obj isHidden] || ![obj isEnabled])
|
||||
continue;
|
||||
|
||||
@@ -384,7 +384,7 @@
|
||||
*/
|
||||
- (void)_selectionDidChange
|
||||
{
|
||||
if (_selection === undefined || _selection === nil)
|
||||
if (_selection == nil)
|
||||
_selection = [[CPControllerSelectionProxy alloc] initWithController:self];
|
||||
|
||||
[_selection controllerDidChange];
|
||||
@@ -770,7 +770,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
}
|
||||
}
|
||||
|
||||
if (value === nil || value.isa && [value isEqual:[CPNull null]])
|
||||
if (value == nil || value.isa && [value isEqual:[CPNull null]])
|
||||
value = CPNullMarker;
|
||||
|
||||
return value;
|
||||
|
||||
@@ -1438,7 +1438,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
_shouldRetargetChildIndex = YES;
|
||||
|
||||
// set CPTableView's _retargetedDropRow based on retargetedItem and retargetedChildIndex
|
||||
var retargetedItemInfo = (_retargetedItem !== nil) ? _itemInfosForItems[[_retargetedItem UID]] : _rootItemInfo;
|
||||
var retargetedItemInfo = (_retargetedItem != nil) ? _itemInfosForItems[[_retargetedItem UID]] : _rootItemInfo;
|
||||
|
||||
if (_retargedChildIndex === [retargetedItemInfo.children count])
|
||||
{
|
||||
@@ -1940,7 +1940,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
if (theDropOperation === CPTableViewDropAbove)
|
||||
{
|
||||
var parentItem = [_outlineView _parentItemForUpperRow:theRow - 1 andLowerRow:theRow atMouseOffset:theOffset],
|
||||
itemInfo = (parentItem !== nil) ? _outlineView._itemInfosForItems[[parentItem UID]] : _outlineView._rootItemInfo,
|
||||
itemInfo = (parentItem != nil) ? _outlineView._itemInfosForItems[[parentItem UID]] : _outlineView._rootItemInfo,
|
||||
children = itemInfo.children;
|
||||
|
||||
childIndex = [children indexOfObject:[_outlineView itemAtRow:theRow]];
|
||||
|
||||
@@ -397,7 +397,7 @@ var CPResponderNextResponderKey = @"CPResponderNextResponderKey",
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
// This will come out nil on the other side with decodeObjectForKey:
|
||||
if (_nextResponder !== nil)
|
||||
if (_nextResponder != nil)
|
||||
[aCoder encodeConditionalObject:_nextResponder forKey:CPResponderNextResponderKey];
|
||||
|
||||
[aCoder encodeObject:_menu forKey:CPResponderMenuKey];
|
||||
|
||||
@@ -157,7 +157,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self !== nil)
|
||||
if (self)
|
||||
{
|
||||
_slices = [[CPMutableArray alloc] init];
|
||||
|
||||
@@ -419,7 +419,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
*/
|
||||
- (void)setFormattingStringsFilename:(CPString)stringsFilename
|
||||
{
|
||||
if (_standardLocalizer === nil)
|
||||
if (_standardLocalizer == nil)
|
||||
_standardLocalizer = [_CPRuleEditorLocalizer new];
|
||||
|
||||
if (_stringsFilename !== stringsFilename)
|
||||
@@ -427,14 +427,14 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
// Convert an empty string to nil
|
||||
_stringsFilename = stringsFilename || nil;
|
||||
|
||||
if (stringsFilename !== nil)
|
||||
if (stringsFilename != nil)
|
||||
{
|
||||
if (![stringsFilename hasSuffix:@".strings"])
|
||||
stringsFilename = stringsFilename + @".strings";
|
||||
|
||||
var path = [[CPBundle mainBundle] pathForResource:stringsFilename];
|
||||
|
||||
if (path !== nil)
|
||||
if (path != nil)
|
||||
[_standardLocalizer loadContentOfURL:[CPURL URLWithString:path]];
|
||||
}
|
||||
}
|
||||
@@ -465,7 +465,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
*/
|
||||
- (void)setCriteria:(CPArray)criteria andDisplayValues:(CPArray)values forRowAtIndex:(int)rowIndex
|
||||
{
|
||||
if (criteria === nil || values === nil)
|
||||
if (criteria == nil || values == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:_cmd + @". criteria and values parameters must not be nil."];
|
||||
|
||||
if (rowIndex < 0 || rowIndex >= [self numberOfRows])
|
||||
@@ -852,7 +852,7 @@ TODO: implement
|
||||
while (current_index !== CPNotFound)
|
||||
{
|
||||
var subpredicate = [self predicateForRow:current_index];
|
||||
if (subpredicate !== nil)
|
||||
if (subpredicate != nil)
|
||||
[subpredicates addObject:subpredicate];
|
||||
|
||||
current_index = [subrowsIndexes indexGreaterThanIndex:current_index];
|
||||
@@ -888,33 +888,33 @@ TODO: implement
|
||||
modifier = [predicateParts objectForKey:CPRuleEditorPredicateComparisonModifier],
|
||||
selector = CPSelectorFromString([predicateParts objectForKey:CPRuleEditorPredicateCustomSelector]);
|
||||
|
||||
if (lhs === nil)
|
||||
if (lhs == nil)
|
||||
{
|
||||
CPLogConsole(@"missing left expression in predicate parts dictionary");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rhs === nil)
|
||||
if (rhs == nil)
|
||||
{
|
||||
CPLogConsole(@"missing right expression in predicate parts dictionary");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (selector === nil && operator === nil)
|
||||
if (selector == nil && operator == nil)
|
||||
{
|
||||
CPLogConsole(@"missing operator and selector in predicate parts dictionary");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (modifier === nil)
|
||||
if (modifier == nil)
|
||||
CPLogConsole(@"missing modifier in predicate parts dictionary. Setting default: CPDirectPredicateModifier");
|
||||
|
||||
if (options === nil)
|
||||
if (options == nil)
|
||||
CPLogConsole(@"missing options in predicate parts dictionary. Setting default: CPCaseInsensitivePredicateOption");
|
||||
|
||||
try
|
||||
{
|
||||
if (selector !== nil)
|
||||
if (selector != nil)
|
||||
predicate = [CPComparisonPredicate predicateWithLeftExpression:lhs
|
||||
rightExpression:rhs
|
||||
customSelector:selector
|
||||
@@ -1167,7 +1167,7 @@ TODO: implement
|
||||
|
||||
- (BOOL)_wantsRowAnimations
|
||||
{
|
||||
return (_currentAnimation !== nil);
|
||||
return (_currentAnimation != nil);
|
||||
}
|
||||
|
||||
- (void)_updateButtonVisibilities
|
||||
@@ -1753,7 +1753,7 @@ TODO: implement
|
||||
{
|
||||
var subpredicate = [self predicateForRow:current_index];
|
||||
|
||||
if (subpredicate !== nil)
|
||||
if (subpredicate != nil)
|
||||
[subpredicates addObject:subpredicate];
|
||||
|
||||
current_index = [subindexes indexGreaterThanIndex:current_index];
|
||||
@@ -1795,7 +1795,7 @@ TODO: implement
|
||||
startRect = [aslice frame],
|
||||
startIndex = [aslice rowIndex] - 1;
|
||||
|
||||
if ([aslice superview] === nil)
|
||||
if ([aslice superview] == nil)
|
||||
{
|
||||
startRect = CGRectMake(0, startIndex * _sliceHeight, CGRectGetWidth(startRect), _sliceHeight);
|
||||
[aslice _reconfigureSubviews];
|
||||
@@ -2129,7 +2129,7 @@ TODO: implement
|
||||
|
||||
- (BOOL)_dragShouldBeginFromMouseDown:(CPView)view
|
||||
{
|
||||
return (([self nestingMode] === CPRuleEditorNestingModeList || [view rowIndex] !== 0) && _editable && [view isKindOfClass:[_CPRuleEditorViewSliceRow class]] && _draggingRows === nil);
|
||||
return (([self nestingMode] === CPRuleEditorNestingModeList || [view rowIndex] !== 0) && _editable && [view isKindOfClass:[_CPRuleEditorViewSliceRow class]] && _draggingRows == nil);
|
||||
}
|
||||
|
||||
- (BOOL)_performDragForSlice:(id)slice withEvent:(CPEvent)event
|
||||
@@ -2321,7 +2321,7 @@ TODO: implement
|
||||
|
||||
- (void)_postRowCountChangedNotificationOfType:(CPString)notificationName indexes:indexes
|
||||
{
|
||||
var userInfo = indexes === nil ? @{} : @{ "indexes": indexes };
|
||||
var userInfo = indexes == nil ? @{} : @{ "indexes": indexes };
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:notificationName object:self userInfo:userInfo];
|
||||
}
|
||||
|
||||
@@ -2386,7 +2386,7 @@ TODO: implement
|
||||
var criteria = [self criteriaForRow:aRow];
|
||||
indexofCriterion = [criteria indexOfObject:criterion];
|
||||
|
||||
if (parentItem !== nil
|
||||
if (parentItem != nil
|
||||
&& indexofCriterion !== CPNotFound
|
||||
&& indexofCriterion < [criteria count] - 1)
|
||||
{
|
||||
@@ -2469,7 +2469,7 @@ var CPRuleEditorAlignmentGridWidthKey = @"CPRuleEditorAlignmentGridWidth",
|
||||
- (id)initWithCoder:(CPCoder)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self !== nil)
|
||||
if (self)
|
||||
{
|
||||
[self setFormattingStringsFilename:[coder decodeObjectForKey:CPRuleEditorStringsFilenameKey]];
|
||||
_alignmentGridWidth = [coder decodeFloatForKey:CPRuleEditorAlignmentGridWidthKey];
|
||||
@@ -2553,7 +2553,7 @@ var CriteriaKey = @"criteria",
|
||||
- (id)initWithCoder:(CPCoder)coder
|
||||
{
|
||||
self = [super init];
|
||||
if (self !== nil)
|
||||
if (self)
|
||||
{
|
||||
subrows = [coder decodeObjectForKey:SubrowsKey];
|
||||
criteria = [coder decodeObjectForKey:CriteriaKey];
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
{
|
||||
var title = [self title];
|
||||
|
||||
if (title !== nil)
|
||||
if (title != nil)
|
||||
return title;
|
||||
|
||||
return [self templateView];
|
||||
|
||||
@@ -40,7 +40,7 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
|
||||
|
||||
- (void)reloadIfNeeded
|
||||
{
|
||||
if (connection !== nil) // Connection waiting
|
||||
if (connection != nil) // Connection waiting
|
||||
{
|
||||
connection = nil;
|
||||
|
||||
@@ -51,7 +51,7 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
|
||||
|
||||
- (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)rawString
|
||||
{
|
||||
if (connection !== nil && rawString !== nil)
|
||||
if (connection != nil && rawString != nil)
|
||||
[self loadContent:rawString];
|
||||
|
||||
connection = nil;
|
||||
@@ -83,11 +83,11 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
|
||||
{
|
||||
[self reloadIfNeeded];
|
||||
|
||||
if (_dictionary !== nil && aString !== nil)
|
||||
if (_dictionary != nil && aString != nil)
|
||||
{
|
||||
var localized = [_dictionary objectForKey:aString];
|
||||
|
||||
if (localized !== nil)
|
||||
if (localized != nil)
|
||||
return localized;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
|
||||
|
||||
var globalValue = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPScrollersGlobalStyle"];
|
||||
|
||||
if (globalValue === nil || globalValue === -1)
|
||||
if (globalValue == nil || globalValue === -1)
|
||||
CPScrollerStyleGlobal = _isBrowserUsingOverlayScrollers() ? CPScrollerStyleOverlay : CPScrollerStyleLegacy
|
||||
else
|
||||
CPScrollerStyleGlobal = globalValue;
|
||||
@@ -309,7 +309,7 @@ Notifies the delegate when the scroll view has finished scrolling.
|
||||
_delegate = aDelegate;
|
||||
_implementedDelegateMethods = 0;
|
||||
|
||||
if (_delegate === nil)
|
||||
if (_delegate == nil)
|
||||
return;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(scrollViewWillScroll:)])
|
||||
|
||||
@@ -183,7 +183,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
||||
- (void)resetSearchButton
|
||||
{
|
||||
var button = [self searchButton],
|
||||
searchButtonImage = (_searchMenuTemplate === nil) ? [self currentValueForThemeAttribute:@"image-search"] : [self currentValueForThemeAttribute:@"image-find"];
|
||||
searchButtonImage = (_searchMenuTemplate == nil) ? [self currentValueForThemeAttribute:@"image-search"] : [self currentValueForThemeAttribute:@"image-find"];
|
||||
|
||||
[button setBordered:NO];
|
||||
[button setImageScaling:CPImageScaleAxesIndependently];
|
||||
@@ -491,7 +491,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
||||
|
||||
- (void)_addStringToRecentSearches:(CPString)string
|
||||
{
|
||||
if (string === nil || string === @"" || [_recentSearches containsObject:string])
|
||||
if (string == nil || string === @"" || [_recentSearches containsObject:string])
|
||||
return;
|
||||
|
||||
var searches = [CPMutableArray arrayWithArray:_recentSearches];
|
||||
@@ -598,7 +598,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
||||
|
||||
- (void)_updateSearchMenu
|
||||
{
|
||||
if (_searchMenuTemplate === nil)
|
||||
if (_searchMenuTemplate == nil)
|
||||
return;
|
||||
|
||||
var menu = [[CPMenu alloc] init],
|
||||
@@ -678,7 +678,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
||||
|
||||
- (void)_showMenu
|
||||
{
|
||||
if (_searchMenu === nil || [_searchMenu numberOfItems] === 0 || ![self isEnabled])
|
||||
if (_searchMenu == nil || [_searchMenu numberOfItems] === 0 || ![self isEnabled])
|
||||
return;
|
||||
|
||||
var aFrame = [[self superview] convertRect:[self frame] toView:nil],
|
||||
@@ -752,12 +752,12 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
||||
- (void)_loadRecentSearchList
|
||||
{
|
||||
var name = [self recentsAutosaveName];
|
||||
if (name === nil)
|
||||
if (name == nil)
|
||||
return;
|
||||
|
||||
var list = [[CPUserDefaults standardUserDefaults] objectForKey:name];
|
||||
|
||||
if (list !== nil)
|
||||
if (list != nil)
|
||||
_recentSearches = list;
|
||||
}
|
||||
|
||||
|
||||
@@ -1168,7 +1168,7 @@ The sum of the views and the sum of the dividers should be equal to the size of
|
||||
{
|
||||
var item = preCollapseArray[i];
|
||||
|
||||
if (item === nil)
|
||||
if (item == nil)
|
||||
[_preCollapsePositions removeObjectForKey:String(i)];
|
||||
else
|
||||
[_preCollapsePositions setObject:item forKey:String(i)];
|
||||
|
||||
+6
-6
@@ -275,7 +275,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
*/
|
||||
- (void)selectNextTabViewItem:(id)aSender
|
||||
{
|
||||
if (_selectedTabViewItem === nil)
|
||||
if (_selectedTabViewItem == nil)
|
||||
return;
|
||||
|
||||
var nextIndex = [self indexOfTabViewItem:_selectedTabViewItem] + 1;
|
||||
@@ -293,7 +293,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
*/
|
||||
- (void)selectPreviousTabViewItem:(id)aSender
|
||||
{
|
||||
if (_selectedTabViewItem === nil)
|
||||
if (_selectedTabViewItem == nil)
|
||||
return;
|
||||
|
||||
var previousIndex = [self indexOfTabViewItem:_selectedTabViewItem] - 1;
|
||||
@@ -353,15 +353,15 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
{
|
||||
var controller = [aTabViewItem viewController];
|
||||
|
||||
if (controller !== nil && ![controller isViewLoaded])
|
||||
if (controller != nil && ![controller isViewLoaded])
|
||||
{
|
||||
[controller loadViewWithCompletionHandler:function(view, error)
|
||||
{
|
||||
if (error !== nil)
|
||||
if (error != nil)
|
||||
{
|
||||
CPLog.warn("Could not load the view for item " + aTabViewItem + ". " + error);
|
||||
}
|
||||
else if (view !== nil)
|
||||
else if (view != nil)
|
||||
{
|
||||
[aTabViewItem setView:view];
|
||||
|
||||
@@ -599,7 +599,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
{
|
||||
var theBinder = [self binderForBinding:CPSelectionIndexesBinding];
|
||||
|
||||
if (theBinder !== nil)
|
||||
if (theBinder != nil)
|
||||
[theBinder reverseSetValueFor:@"selectionIndexes"];
|
||||
else
|
||||
{
|
||||
|
||||
@@ -593,7 +593,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
{
|
||||
var options = [_info objectForKey:CPOptionsKey],
|
||||
optionValue = [options objectForKey:CPCreatesSortDescriptorBindingOption];
|
||||
return optionValue === nil ? YES : [optionValue boolValue];
|
||||
return optionValue == nil ? YES : [optionValue boolValue];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2977,7 +2977,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
oldMainSortDescriptor = [[self sortDescriptors] objectAtIndex: 0];
|
||||
|
||||
// Remove every main descriptor equivalents (normally only one)
|
||||
while ((descriptor = [e nextObject]) !== nil)
|
||||
while ((descriptor = [e nextObject]) != nil)
|
||||
{
|
||||
if ([[descriptor key] isEqual: [newMainSortDescriptor key]])
|
||||
[outdatedDescriptors addObject:descriptor];
|
||||
@@ -3319,7 +3319,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
var oldSortDescriptors = [[self sortDescriptors] copy],
|
||||
newSortDescriptors = [CPArray array];
|
||||
|
||||
if (sortDescriptors !== nil)
|
||||
if (sortDescriptors != nil)
|
||||
[newSortDescriptors addObjectsFromArray:sortDescriptors];
|
||||
|
||||
if ([newSortDescriptors isEqual:oldSortDescriptors])
|
||||
@@ -3380,7 +3380,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
objectValue = tableColumnObjectValues[aRowIndex];
|
||||
|
||||
// tableView:objectValueForTableColumn:row: is optional if content bindings are in place.
|
||||
if (objectValue === undefined)
|
||||
if (objectValue == nil)
|
||||
{
|
||||
if ([self _dataSourceRespondsToObjectValueForTableColumn])
|
||||
{
|
||||
@@ -3835,7 +3835,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
else if ([self _delegateRespondsToDataViewForTableColumn])
|
||||
_viewForTableColumnRowSelector = @selector(_sendDelegateDataViewForTableColumn:row:);
|
||||
|
||||
_isViewBased = (_viewForTableColumnRowSelector !== nil || _archivedDataViews !== nil);
|
||||
_isViewBased = (_viewForTableColumnRowSelector != nil || _archivedDataViews != nil);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -4724,7 +4724,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
dropOperation = [self _proposedDropOperationAtPoint:location],
|
||||
row = [self _proposedRowAtPoint:location];
|
||||
|
||||
if (_retargetedDropRow !== nil)
|
||||
if (_retargetedDropRow != nil)
|
||||
row = _retargetedDropRow;
|
||||
|
||||
var draggedTypes = [self registeredDraggedTypes],
|
||||
@@ -4780,7 +4780,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
*/
|
||||
- (CPTableViewDropOperation)_proposedDropOperationAtPoint:(CGPoint)theDragPoint
|
||||
{
|
||||
if (_retargetedDropOperation !== nil)
|
||||
if (_retargetedDropOperation != nil)
|
||||
return _retargetedDropOperation;
|
||||
|
||||
var row = [self _proposedRowAtPoint:theDragPoint],
|
||||
@@ -4859,10 +4859,10 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
row = [self _proposedRowAtPoint:location],
|
||||
dragOperation = [self _sendDataSourceValidateDrop:sender proposedRow:row proposedDropOperation:dropOperation];
|
||||
|
||||
if (_retargetedDropRow !== nil)
|
||||
if (_retargetedDropRow != nil)
|
||||
row = _retargetedDropRow;
|
||||
|
||||
if (_retargetedDropOperation !== nil)
|
||||
if (_retargetedDropOperation != nil)
|
||||
dropOperation = _retargetedDropOperation;
|
||||
|
||||
if (dropOperation === CPTableViewDropOn && row >= numberOfRows)
|
||||
@@ -4907,7 +4907,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
operation = [self _proposedDropOperationAtPoint:location],
|
||||
row = _retargetedDropRow;
|
||||
|
||||
if (row === nil)
|
||||
if (row == nil)
|
||||
row = [self _proposedRowAtPoint:location];
|
||||
|
||||
return [self _sendDataSourceAcceptDrop:sender row:row dropOperation:operation];
|
||||
|
||||
@@ -1332,7 +1332,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
// If there is a formatter, make sure the object value can be formatted successfully
|
||||
var formattedString = [self hasThemeState:CPThemeStateEditing] ? [formatter editingStringForObjectValue:aValue] : [formatter stringForObjectValue:aValue];
|
||||
|
||||
if (formattedString === nil)
|
||||
if (formattedString == nil)
|
||||
{
|
||||
var value = nil;
|
||||
|
||||
@@ -1342,7 +1342,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
value = undefined;
|
||||
|
||||
[super setObjectValue:value];
|
||||
_stringValue = (value === nil || value === undefined) ? @"" : String(value);
|
||||
_stringValue = (value == nil) ? @"" : String(value);
|
||||
}
|
||||
else
|
||||
_stringValue = formattedString;
|
||||
@@ -1498,7 +1498,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
else
|
||||
[[CPRunLoop mainRunLoop] performBlock:function(){ element.select(); } argument:nil order:0 modes:[CPDefaultRunLoopMode]];
|
||||
}
|
||||
else if (wind !== nil && [wind makeFirstResponder:self])
|
||||
else if (wind != nil && [wind makeFirstResponder:self])
|
||||
[self _selectText:sender immediately:immediately];
|
||||
}
|
||||
else
|
||||
@@ -1508,7 +1508,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
#else
|
||||
// Even if we can't actually select the text we need to preserve the first
|
||||
// responder side effect.
|
||||
if (wind !== nil && [wind firstResponder] !== self)
|
||||
if (wind != nil && [wind firstResponder] !== self)
|
||||
[wind makeFirstResponder:self];
|
||||
#endif
|
||||
}
|
||||
@@ -2153,7 +2153,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
||||
newValue = [self valueForBinding:aBinding],
|
||||
value = [destination valueForKeyPath:keyPath];
|
||||
|
||||
if (CPIsControllerMarker(value) && newValue === nil)
|
||||
if (CPIsControllerMarker(value) && newValue == nil)
|
||||
return;
|
||||
|
||||
newValue = [self reverseTransformValue:newValue withOptions:options];
|
||||
|
||||
@@ -94,7 +94,7 @@ var _availableTraits= [@"Normal", @"Italic", @"Bold", @"Bold Italic"],
|
||||
*/
|
||||
+ (BOOL)sharedFontPanelExists
|
||||
{
|
||||
return _sharedFontPanel !== nil;
|
||||
return _sharedFontPanel != nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -980,7 +980,7 @@ Sets the selection to a range of characters in response to user action.
|
||||
if (!isNewSelection && _mouseDownOldSelection)
|
||||
isNewSelection = !CPEqualRanges(newSelectionRange, _mouseDownOldSelection);
|
||||
|
||||
if (doOverwrite && _placeholderString === nil && isNewSelection)
|
||||
if (doOverwrite && _placeholderString == nil && isNewSelection)
|
||||
[self setTypingAttributes:[_textStorage attributesAtIndex:CPMaxRange(range) effectiveRange:nil]];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPTextViewDidChangeSelectionNotification object:self];
|
||||
@@ -2916,7 +2916,7 @@ var _CPCopyPlaceholder = '-';
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
if (aValue === nil || (aValue.isa && [aValue isMemberOfClass:CPNull]))
|
||||
if (aValue == nil || (aValue.isa && [aValue isMemberOfClass:CPNull]))
|
||||
[_source _setPlaceholderString:[self _placeholderForMarker:CPNullMarker]];
|
||||
else
|
||||
[_source _setPlaceholderString:nil];
|
||||
|
||||
@@ -113,7 +113,7 @@ function _points2twips(a) { return (a) * 20.0; }
|
||||
keyArray = [keyArray sortedArrayUsingSelector:@selector(compare:)];
|
||||
fontEnum = [keyArray objectEnumerator];
|
||||
|
||||
while ((currFont = [fontEnum nextObject]) !== nil)
|
||||
while ((currFont = [fontEnum nextObject]) != nil)
|
||||
{
|
||||
var fontFamily,
|
||||
detail;
|
||||
@@ -149,7 +149,7 @@ function _points2twips(a) { return (a) * 20.0; }
|
||||
next,
|
||||
i;
|
||||
|
||||
while ((next = [keyEnum nextObject]) !== nil)
|
||||
while ((next = [keyEnum nextObject]) != nil)
|
||||
{
|
||||
var cn = [colorDict objectForKey:next];
|
||||
[list insertObject:[CPColor colorWithCSSString:next] atIndex:[cn intValue]-1];
|
||||
|
||||
+6
-6
@@ -259,7 +259,7 @@ var CPThemesByName = { },
|
||||
attributeNames = [attributes keyEnumerator],
|
||||
objectThemeClass = [anObject themeClass];
|
||||
|
||||
while ((attributeName = [attributeNames nextObject]) !== nil)
|
||||
while ((attributeName = [attributeNames nextObject]) != nil)
|
||||
[self _recordAttribute:[attributes objectForKey:attributeName] forClass:objectThemeClass];
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
||||
{
|
||||
var attribute = [[_CPThemeAttribute alloc] initWithName:_name defaultValue:_defaultValue defaultAttribute:_themeDefaultAttribute];
|
||||
|
||||
if (aValue !== undefined && aValue !== nil)
|
||||
if (aValue != nil)
|
||||
attribute._values = @{ CPThemeStateNormalString: aValue };
|
||||
|
||||
return attribute;
|
||||
@@ -695,7 +695,7 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
||||
|
||||
- (_CPThemeAttribute)attributeBySettingValue:(id)aValue forState:(ThemeState)aState
|
||||
{
|
||||
var shouldRemoveValue = aValue === undefined || aValue === nil,
|
||||
var shouldRemoveValue = aValue == nil,
|
||||
attribute = [[_CPThemeAttribute alloc] initWithName:_name defaultValue:_defaultValue defaultAttribute:_themeDefaultAttribute],
|
||||
values = _values;
|
||||
|
||||
@@ -738,7 +738,7 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
||||
// Not in cache. OK, search in values.
|
||||
value = [_values objectForKey:stateName];
|
||||
|
||||
if ((value !== undefined) && (value !== nil))
|
||||
if (value != nil)
|
||||
return _cache[stateName] = value;
|
||||
|
||||
// No direct match in values.
|
||||
@@ -754,13 +754,13 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
||||
// Still don't have a value? OK, let's use the normal value.
|
||||
value = [_values objectForKey:String(CPThemeStateNormal)];
|
||||
|
||||
if ((value !== undefined) && (value !== nil))
|
||||
if (value != nil)
|
||||
return _cache[stateName] = value;
|
||||
|
||||
// No normal value, try asking _themeDefaultAttribute
|
||||
value = [_themeDefaultAttribute valueForState:aState];
|
||||
|
||||
if ((value !== undefined) && (value !== nil))
|
||||
if (value != nil)
|
||||
return _cache[stateName] = value;
|
||||
|
||||
// Well, last option, use default value
|
||||
|
||||
@@ -630,7 +630,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
|
||||
- (void)setObjectValue:(id)aValue
|
||||
{
|
||||
if (aValue !== nil && ![aValue isKindOfClass:[CPArray class]])
|
||||
if (aValue != nil && ![aValue isKindOfClass:[CPArray class]])
|
||||
{
|
||||
[super setObjectValue:nil];
|
||||
return;
|
||||
@@ -645,7 +645,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
newTokens = [];
|
||||
|
||||
// Preserve as many existing tokens as possible to reduce redraw flickering.
|
||||
if (aValue !== nil)
|
||||
if (aValue != nil)
|
||||
{
|
||||
for (var i = 0, count = [aValue count]; i < count; i++)
|
||||
{
|
||||
@@ -666,7 +666,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (newToken === nil)
|
||||
if (newToken == nil)
|
||||
{
|
||||
newToken = [_CPTokenFieldToken new];
|
||||
[newToken setTokenField:self];
|
||||
@@ -1310,7 +1310,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
{
|
||||
var stringForRepresentedObject = [_tokenFieldDelegate tokenField:self displayStringForRepresentedObject:representedObject];
|
||||
|
||||
if (stringForRepresentedObject !== nil)
|
||||
if (stringForRepresentedObject != nil)
|
||||
return stringForRepresentedObject;
|
||||
}
|
||||
|
||||
@@ -1332,7 +1332,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
{
|
||||
var approvedObjects = [_tokenFieldDelegate tokenField:self shouldAddObjects:tokens atIndex:index];
|
||||
|
||||
if (approvedObjects !== nil)
|
||||
if (approvedObjects != nil)
|
||||
return approvedObjects;
|
||||
}
|
||||
|
||||
@@ -1354,7 +1354,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
{
|
||||
var token = [_tokenFieldDelegate tokenField:self representedObjectForEditingString:aString];
|
||||
|
||||
if (token !== nil && token !== undefined)
|
||||
if (token != nil)
|
||||
return token;
|
||||
// If nil was returned, assume the string is the represented object. The alternative would have been
|
||||
// to not add anything to the object value array for a nil response.
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ var CPToolbarsByIdentifier = nil,
|
||||
|
||||
item = [item copy];
|
||||
|
||||
if (item === nil)
|
||||
if (item == nil)
|
||||
[CPException raise:CPInvalidArgumentException
|
||||
reason:@"Toolbar delegate " + _delegate + " returned nil toolbar item for identifier \"" + identifier + "\""];
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
|
||||
|
||||
A CPTrackingArea defines a region of view that generates mouse-tracking and
|
||||
cursor-update events when the mouse is over that region.
|
||||
*/
|
||||
@@ -61,7 +61,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
||||
CPTrackingAreaOptions _options @accessors(getter=options);
|
||||
id _owner @accessors(getter=owner);
|
||||
CPDictionary _userInfo @accessors(getter=userInfo);
|
||||
|
||||
|
||||
CPView _referencingView @accessors(property=view);
|
||||
CGRect _windowRect @accessors(getter=windowRect);
|
||||
|
||||
@@ -72,13 +72,13 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
/*!
|
||||
Initializes and returns an object defining a region of a view to receive mouse-tracking events, mouse-moved events, cursor-update events, or possibly
|
||||
/*!
|
||||
Initializes and returns an object defining a region of a view to receive mouse-tracking events, mouse-moved events, cursor-update events, or possibly
|
||||
all these events.
|
||||
*/
|
||||
- (CPTrackingArea)initWithRect:(CGRect)aRect options:(CPTrackingAreaOptions)options owner:(id)owner userInfo:(CPDictionary)userInfo
|
||||
{
|
||||
if (owner === nil)
|
||||
if (owner == nil)
|
||||
[CPException raise:CPInternalInconsistencyException reason:"No owner specified"];
|
||||
|
||||
if (options === 0)
|
||||
@@ -116,7 +116,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
||||
if ([_owner respondsToSelector:@selector(cursorUpdate:)])
|
||||
_implementedOwnerMethods |= CPTrackingOwnerImplementsCursorUpdate;
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
||||
_referencingView = [aCoder decodeObjectForKey:CPTrackingAreaReferencingViewKey];
|
||||
_windowRect = [aCoder decodeObjectForKey:CPTrackingAreaWindowRect];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,13 +160,13 @@ var CPUserDefaultsControllerSharedKey = "CPUserDefaultsControllerSharedKey";
|
||||
- (id)valueForKey:(CPString)aKey
|
||||
{
|
||||
var value = [_cachedValues objectForKey:aKey];
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
{
|
||||
value = [[_controller defaults] objectForKey:aKey];
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
value = [[_controller initialValues] objectForKey:aKey];
|
||||
|
||||
if (value !== nil)
|
||||
if (value != nil)
|
||||
[_cachedValues setObject:value forKey:aKey];
|
||||
}
|
||||
return value;
|
||||
@@ -220,7 +220,7 @@ var CPUserDefaultsControllerSharedKey = "CPUserDefaultsControllerSharedKey";
|
||||
[self willChangeValueForKey:key];
|
||||
|
||||
var initialValue = [initial objectForKey:key];
|
||||
if (initialValue !== nil)
|
||||
if (initialValue != nil)
|
||||
[_cachedValues setObject:initialValue forKey:key];
|
||||
else
|
||||
[_cachedValues removeObjectForKey:key];
|
||||
|
||||
+9
-9
@@ -800,7 +800,7 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
var addedSubview = nil,
|
||||
addedSubviewEnumerator = [addedSubviews objectEnumerator];
|
||||
|
||||
while ((addedSubview = [addedSubviewEnumerator nextObject]) !== nil)
|
||||
while ((addedSubview = [addedSubviewEnumerator nextObject]) != nil)
|
||||
[self addSubview:addedSubview];
|
||||
|
||||
// If the order is fine, no need to reorder.
|
||||
@@ -1703,8 +1703,8 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
|
||||
- (void)_setSuperview:(CPView)aSuperview
|
||||
{
|
||||
var hasOldSuperview = (_superview !== nil),
|
||||
hasNewSuperview = (aSuperview !== nil),
|
||||
var hasOldSuperview = (_superview != nil),
|
||||
hasNewSuperview = (aSuperview != nil),
|
||||
oldSuperviewIsHidden = hasOldSuperview && [_superview isHiddenOrHasHiddenAncestor],
|
||||
newSuperviewIsHidden = hasNewSuperview && [aSuperview isHiddenOrHasHiddenAncestor];
|
||||
|
||||
@@ -3802,7 +3802,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
|
||||
// Other views (CPBox) might set an autoresizes mask on their subviews before it is actually decoded.
|
||||
// We make sure we don't override the value by checking if it was already set.
|
||||
if (_autoresizingMask === nil)
|
||||
if (_autoresizingMask == nil)
|
||||
_autoresizingMask = [aCoder decodeIntForKey:CPViewAutoresizingMaskKey] || CPViewNotSizable;
|
||||
|
||||
_autoresizesSubviews = ![aCoder containsValueForKey:CPViewAutoresizesSubviewsKey] || [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey];
|
||||
@@ -3876,7 +3876,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
[aCoder encodeRect:_bounds forKey:CPViewBoundsKey];
|
||||
|
||||
// This will come out nil on the other side with decodeObjectForKey:
|
||||
if (_window !== nil)
|
||||
if (_window != nil)
|
||||
[aCoder encodeConditionalObject:_window forKey:CPViewWindowKey];
|
||||
|
||||
var count = [_subviews count],
|
||||
@@ -3895,7 +3895,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
[aCoder encodeObject:encodedSubviews forKey:CPViewSubviewsKey];
|
||||
|
||||
// This will come out nil on the other side with decodeObjectForKey:
|
||||
if (_superview !== nil)
|
||||
if (_superview != nil)
|
||||
[aCoder encodeConditionalObject:_superview forKey:CPViewSuperviewKey];
|
||||
|
||||
if (_autoresizingMask !== CPViewNotSizable)
|
||||
@@ -3904,7 +3904,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
if (!_autoresizesSubviews)
|
||||
[aCoder encodeBool:_autoresizesSubviews forKey:CPViewAutoresizesSubviewsKey];
|
||||
|
||||
if (_backgroundColor !== nil)
|
||||
if (_backgroundColor != nil)
|
||||
[aCoder encodeObject:_backgroundColor forKey:CPViewBackgroundColorKey];
|
||||
|
||||
if (_hitTests !== YES)
|
||||
@@ -3921,12 +3921,12 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
|
||||
var nextKeyView = [self nextKeyView];
|
||||
|
||||
if (nextKeyView !== nil && ![nextKeyView isEqual:self])
|
||||
if (nextKeyView != nil && ![nextKeyView isEqual:self])
|
||||
[aCoder encodeConditionalObject:nextKeyView forKey:CPViewNextKeyViewKey];
|
||||
|
||||
var previousKeyView = [self previousKeyView];
|
||||
|
||||
if (previousKeyView !== nil && ![previousKeyView isEqual:self])
|
||||
if (previousKeyView != nil && ![previousKeyView isEqual:self])
|
||||
[aCoder encodeConditionalObject:previousKeyView forKey:CPViewPreviousKeyViewKey];
|
||||
|
||||
[self _encodeThemeObjectsWithCoder:aCoder];
|
||||
|
||||
@@ -258,7 +258,7 @@ var CPViewControllerCachedCibs;
|
||||
|
||||
[self loadView];
|
||||
|
||||
if (_view === nil && [cibOwner isKindOfClass:[CPDocument class]])
|
||||
if (_view == nil && [cibOwner isKindOfClass:[CPDocument class]])
|
||||
[self setView:[cibOwner valueForKey:@"view"]];
|
||||
|
||||
if (!_view)
|
||||
@@ -408,7 +408,7 @@ var CPViewControllerCachedCibs;
|
||||
[self willChangeValueForKey:"isViewLoaded"];
|
||||
|
||||
_view = aView;
|
||||
_isViewLoaded = aView !== nil;
|
||||
_isViewLoaded = aView != nil;
|
||||
|
||||
if (willChangeIsViewLoaded)
|
||||
[self didChangeValueForKey:"isViewLoaded"];
|
||||
@@ -421,7 +421,7 @@ var CPViewControllerCachedCibs;
|
||||
|
||||
- (void)_registerOrUnregister:(BOOL)shouldRegister notificationsForView:(CPView)aView
|
||||
{
|
||||
if (aView === nil)
|
||||
if (aView == nil)
|
||||
return;
|
||||
|
||||
var center = [CPNotificationCenter defaultCenter],
|
||||
|
||||
+3
-3
@@ -470,7 +470,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
|
||||
_iframe.src = _url;
|
||||
}
|
||||
else if (_html !== nil)
|
||||
else if (_html != nil)
|
||||
{
|
||||
// clear the iframe
|
||||
_iframe.src = "";
|
||||
@@ -480,7 +480,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
|
||||
_ignoreLoadEnd = NO;
|
||||
|
||||
if (_loadHTMLStringTimer !== nil)
|
||||
if (_loadHTMLStringTimer != nil)
|
||||
{
|
||||
window.clearTimeout(_loadHTMLStringTimer);
|
||||
_loadHTMLStringTimer = nil;
|
||||
@@ -848,7 +848,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
- (@action)reload:(id)sender
|
||||
{
|
||||
// If we're displaying pure HTML, redisplay it.
|
||||
if (!_url && (_html !== nil))
|
||||
if (!_url && (_html != nil))
|
||||
[self loadHTMLString:_html];
|
||||
else
|
||||
[self _loadMainFrameURL];
|
||||
|
||||
@@ -3119,7 +3119,7 @@ CPTexturedBackgroundWindowMask
|
||||
*/
|
||||
- (CPWindow)attachedSheet
|
||||
{
|
||||
if (_sheetContext === nil)
|
||||
if (_sheetContext == nil)
|
||||
return nil;
|
||||
|
||||
return _sheetContext["sheet"];
|
||||
|
||||
@@ -752,7 +752,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
|
||||
- (BOOL)showsResizeIndicator
|
||||
{
|
||||
return _resizeIndicator !== nil;
|
||||
return _resizeIndicator != nil;
|
||||
}
|
||||
|
||||
- (void)setResizeIndicatorOffset:(CGSize)anOffset
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
*/
|
||||
- (BOOL)isWindowLoaded
|
||||
{
|
||||
return _window !== nil;
|
||||
return _window != nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
[self loadWindow];
|
||||
|
||||
if (_window === nil && [_cibOwner isKindOfClass:[CPDocument class]])
|
||||
if (_window == nil && [_cibOwner isKindOfClass:[CPDocument class]])
|
||||
[self setWindow:[_cibOwner valueForKey:@"window"]];
|
||||
|
||||
if (!_window)
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ var CPCibObjectDataKey = @"CPCibObjectDataKey";
|
||||
var key = nil,
|
||||
keyEnumerator = [replacementClasses keyEnumerator];
|
||||
|
||||
while ((key = [keyEnumerator nextObject]) !== nil)
|
||||
while ((key = [keyEnumerator nextObject]) != nil)
|
||||
[unarchiver setClass:[replacementClasses objectForKey:key] forClassName:key];
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
var object = nil,
|
||||
objectEnumerator = [_visibleWindows objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
[_replacementObjects[[object UID]] makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ var frameToCSSTranslationTransformMatrix = function(start, current)
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([[self animatorClass] _cssPropertiesForKeyPath:aKey] !== nil)
|
||||
if ([[self animatorClass] _cssPropertiesForKeyPath:aKey] != nil)
|
||||
return [CAAnimation animation];
|
||||
|
||||
return nil;
|
||||
|
||||
@@ -25,7 +25,7 @@ var _supportsCSSAnimations = null;
|
||||
if ([self class] !== [_CPObjectAnimator class])
|
||||
return;
|
||||
|
||||
var compat = (CPBrowserCSSProperty("animation") !== nil);
|
||||
var compat = (CPBrowserCSSProperty("animation") != nil);
|
||||
CPSetPlatformFeature(CPCSSAnimationFeature, compat);
|
||||
}
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ function CGContextFillRect(aContext, aRect)
|
||||
*/
|
||||
function CGContextFillRects(aContext, rects, count)
|
||||
{
|
||||
if (arguments[2] === undefined)
|
||||
if (arguments[2] == nil)
|
||||
var count = rects.length;
|
||||
|
||||
CGContextBeginPath(aContext);
|
||||
@@ -641,7 +641,7 @@ function CGContextStrokeLineSegments(aContext, points, count)
|
||||
{
|
||||
var i = 0;
|
||||
|
||||
if (count === NULL)
|
||||
if (count == NULL)
|
||||
var count = points.length;
|
||||
|
||||
CGContextBeginPath(aContext);
|
||||
|
||||
@@ -140,7 +140,7 @@ function CGContextAddCurveToPoint(aContext, cp1x, cp1y, cp2x, cp2y, x, y)
|
||||
function CGContextAddLines(aContext, points, count)
|
||||
{
|
||||
// implementation mirrors that of CGPathAddLines()
|
||||
if (count === null || count === undefined)
|
||||
if (count == null)
|
||||
count = points.length;
|
||||
|
||||
if (count < 1)
|
||||
@@ -234,7 +234,7 @@ function CGContextAddQuadCurveToPoint(aContext, cpx, cpy, x, y)
|
||||
|
||||
function CGContextAddRects(aContext, rects, count)
|
||||
{
|
||||
if (count === null || count === undefined)
|
||||
if (count == null)
|
||||
count = rects.length;
|
||||
|
||||
for (var i = 0; i < count; ++i)
|
||||
@@ -297,7 +297,7 @@ function CGContextFillRect(aContext, aRect)
|
||||
|
||||
function CGContextFillRects(aContext, rects, count)
|
||||
{
|
||||
if (count === null || count === undefined)
|
||||
if (count == null)
|
||||
count = rects.length;
|
||||
|
||||
for (var i = 0; i < count; ++i)
|
||||
@@ -333,7 +333,7 @@ function CGContextClipToRect(aContext, aRect)
|
||||
|
||||
function CGContextClipToRects(aContext, rects, count)
|
||||
{
|
||||
if (count === null || count === undefined)
|
||||
if (count == null)
|
||||
count = rects.length;
|
||||
|
||||
_CGContextBeginPathCanvas(aContext);
|
||||
|
||||
@@ -30,7 +30,7 @@ kCGGradientDrawsAfterEndLocation = 1 << 1;
|
||||
|
||||
function CGGradientCreateWithColorComponents(aColorSpace, components, locations, count)
|
||||
{
|
||||
if (locations === undefined || locations === NULL)
|
||||
if (locations == NULL)
|
||||
{
|
||||
var num_of_colors = components.length / 4,
|
||||
locations = [];
|
||||
@@ -39,7 +39,7 @@ function CGGradientCreateWithColorComponents(aColorSpace, components, locations,
|
||||
locations.push( idx / (num_of_colors - 1) );
|
||||
}
|
||||
|
||||
if (count === undefined || count === NULL)
|
||||
if (count == NULL)
|
||||
count = locations.length;
|
||||
|
||||
var colors = [];
|
||||
|
||||
@@ -188,7 +188,7 @@ function CGPathAddCurveToPoint(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y)
|
||||
|
||||
function CGPathAddLines(aPath, aTransform, points, count)
|
||||
{
|
||||
if (count === null || count === undefined)
|
||||
if (count == null)
|
||||
count = points.length;
|
||||
|
||||
if (!aPath || count < 1)
|
||||
@@ -284,7 +284,7 @@ function CGPathAddRects(aPath, aTransform, rects, count)
|
||||
{
|
||||
var i = 0;
|
||||
|
||||
if (count === NULL)
|
||||
if (count == NULL)
|
||||
var count = rects.length;
|
||||
|
||||
for (; i < count; ++i)
|
||||
|
||||
@@ -156,7 +156,7 @@ var screenNeedsInitialization = NO,
|
||||
platformWindowEnumerator = [platformWindows objectEnumerator],
|
||||
platformWindow = nil;
|
||||
|
||||
while ((platformWindow = [platformWindowEnumerator nextObject]) !== nil)
|
||||
while ((platformWindow = [platformWindowEnumerator nextObject]) != nil)
|
||||
{
|
||||
if (platformWindow != primaryPlatformWindow)
|
||||
[platformWindow orderOut:self];
|
||||
|
||||
@@ -602,7 +602,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
}
|
||||
}
|
||||
|
||||
var needsDOMImageElement = _image !== nil && _imagePosition !== CPNoImage,
|
||||
var needsDOMImageElement = _image != nil && _imagePosition !== CPNoImage,
|
||||
hasDOMImageElement = !!_DOMImageElement,
|
||||
// For CSS theming
|
||||
isCSSBasedImage = [_image isCSSBased],
|
||||
|
||||
@@ -523,7 +523,7 @@ var ListColumnIdentifier = @"1";
|
||||
{
|
||||
var value = [self selectedObjectValue];
|
||||
|
||||
return value !== nil ? [_dataSource list:self stringValueForObjectValue:value] : nil;
|
||||
return value != nil ? [_dataSource list:self stringValueForObjectValue:value] : nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -264,7 +264,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
originTop.x += platformRect.size.width / 2.0 - frameSize.width / 2.0;
|
||||
originTop.y -= frameSize.height;
|
||||
|
||||
var requestedEdge = (anEdge !== nil) ? anEdge : CPMaxXEdge,
|
||||
var requestedEdge = (anEdge != nil) ? anEdge : CPMaxXEdge,
|
||||
requestedOrigin;
|
||||
|
||||
switch (requestedEdge)
|
||||
|
||||
+5
-5
@@ -394,7 +394,7 @@ Every brace gets its own line, very simple to remember:
|
||||
|
||||
In JavaScript, the null object value should be written as null. In Objective-J, it should be written as `nil` when the variable refers to an object, and `Nil` when it refers to a `Class`. Objective-J `BOOL` values should be written as `YES` and `NO`.
|
||||
|
||||
Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done without equality comparisons, except for cases when a value could be both 0 or `null` (or another "falsey" value). In this case, the comparison should be preceded by a comment explaining the distinction.
|
||||
Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done without equality comparisons, except for cases when a value could be both 0, "" or `null` (or another "falsey" value). In this case, the comparison should be preceded by a comment explaining the distinction. When comparing with nil/null always use '==' / '!=' as the value cound also be undefined.
|
||||
|
||||
##### Right:
|
||||
|
||||
@@ -407,8 +407,8 @@ Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done wi
|
||||
if (!count)
|
||||
return;
|
||||
|
||||
// object is an ID number, so 0 is OK, but null is not.
|
||||
if (object === null)
|
||||
// object is an ID number, so 0 is OK, but null/undefined is not.
|
||||
if (object == null)
|
||||
return;
|
||||
|
||||
##### Wrong:
|
||||
@@ -416,13 +416,13 @@ Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done wi
|
||||
if (condition == true)
|
||||
doIt();
|
||||
|
||||
if (ptr == NULL)
|
||||
if (ptr === NULL)
|
||||
return;
|
||||
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
if (object == null)
|
||||
if (object === null)
|
||||
return;
|
||||
|
||||
---
|
||||
|
||||
@@ -458,11 +458,11 @@
|
||||
enumerator = [self objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
{
|
||||
var value = [object valueForKey:aKey];
|
||||
|
||||
if (value === nil || value === undefined)
|
||||
if (value == nil)
|
||||
value = [CPNull null];
|
||||
|
||||
newArray.push(value);
|
||||
@@ -499,11 +499,11 @@
|
||||
enumerator = [self objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
{
|
||||
var value = [object valueForKeyPath:aKeyPath];
|
||||
|
||||
if (value === nil || value === undefined)
|
||||
if (value == nil)
|
||||
value = [CPNull null];
|
||||
|
||||
newArray.push(value);
|
||||
@@ -518,7 +518,7 @@
|
||||
var enumerator = [self objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
[object setValue:aValue forKey:aKey];
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@
|
||||
var enumerator = [self objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
[object setValue:aValue forKeyPath:aKeyPath];
|
||||
}
|
||||
|
||||
|
||||
@@ -527,10 +527,10 @@ var sortArrayUsingJSDescriptors = function(a, d)
|
||||
key = dd.k;
|
||||
value1 = C1[key];
|
||||
value2 = C2[key];
|
||||
if (value1 === nil || value1 === cpNull)
|
||||
o = value2 === nil || value2 === cpNull ? CPOrderedSame : CPOrderedAscending;
|
||||
if (value1 == nil || value1 === cpNull)
|
||||
o = value2 == nil || value2 === cpNull ? CPOrderedSame : CPOrderedAscending;
|
||||
else
|
||||
o = value2 === nil || value2 === cpNull ? CPOrderedDescending : value1.isa.objj_msgSend1(value1, dd.s, value2);
|
||||
o = value2 == nil || value2 === cpNull ? CPOrderedDescending : value1.isa.objj_msgSend1(value1, dd.s, value2);
|
||||
|
||||
if (o && !dd.a)
|
||||
o = -o;
|
||||
|
||||
@@ -708,7 +708,7 @@ Returns a hash for the object. Unlike Cocoa, the hash value does not take conten
|
||||
var count = [self count],
|
||||
otherCount = [anArray count];
|
||||
|
||||
if (anArray === nil || count !== otherCount)
|
||||
if (anArray == nil || count !== otherCount)
|
||||
return NO;
|
||||
|
||||
var index = 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ var concat = Array.prototype.concat,
|
||||
count = arguments.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
if (arguments[index] === nil)
|
||||
if (arguments[index] == nil)
|
||||
break;
|
||||
|
||||
return slice.call(arguments, 2, index);
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
// private method
|
||||
- (unsigned)_indexOfEntryWithIndex:(unsigned)anIndex
|
||||
{
|
||||
if (anIndex < 0 || anIndex > _string.length || anIndex === undefined)
|
||||
if (anIndex < 0 || anIndex > _string.length || anIndex == nil)
|
||||
return CPNotFound;
|
||||
|
||||
// find the range entry that contains anIndex.
|
||||
|
||||
@@ -243,7 +243,7 @@ var CPCharacterSetInvertedKey = @"CPCharacterSetInvertedKey";
|
||||
enu = [_ranges objectEnumerator],
|
||||
range;
|
||||
|
||||
while ((range = [enu nextObject]) !== nil)
|
||||
while ((range = [enu nextObject]) != nil)
|
||||
{
|
||||
if (CPLocationInRange(c, range))
|
||||
return !_inverted;
|
||||
@@ -265,7 +265,7 @@ var CPCharacterSetInvertedKey = @"CPCharacterSetInvertedKey";
|
||||
var enu = [_ranges objectEnumerator],
|
||||
range;
|
||||
|
||||
while ((range = [enu nextObject]) !== nil)
|
||||
while ((range = [enu nextObject]) != nil)
|
||||
{
|
||||
if (!CPEmptyRange(range))
|
||||
return YES;
|
||||
|
||||
+10
-10
@@ -127,7 +127,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
|
||||
var value = object[key];
|
||||
|
||||
if (value === null)
|
||||
if (value == null)
|
||||
{
|
||||
[dictionary setObject:[CPNull null] forKey:key];
|
||||
continue;
|
||||
@@ -147,7 +147,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
{
|
||||
var thisValue = value[i];
|
||||
|
||||
if (thisValue === null)
|
||||
if (thisValue == null)
|
||||
{
|
||||
newValue.push([CPNull null]);
|
||||
}
|
||||
@@ -234,10 +234,10 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
var value = objects[i],
|
||||
key = keyArray[i];
|
||||
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + i + @"]"];
|
||||
|
||||
if (key === nil)
|
||||
if (key == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + i + @"]"];
|
||||
|
||||
[self setObject:value forKey:key];
|
||||
@@ -278,10 +278,10 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
var key = arguments[argCount--],
|
||||
value = arguments[argCount];
|
||||
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + ((argCount / 2) - 1) + @"]"];
|
||||
|
||||
if (key === nil)
|
||||
if (key == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + ((argCount / 2) - 1) + @"]"];
|
||||
|
||||
[self setObject:value forKey:key];
|
||||
@@ -593,10 +593,10 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
*/
|
||||
- (void)setObject:(id)anObject forKey:(id)aKey
|
||||
{
|
||||
if (aKey === nil)
|
||||
if (aKey == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"key cannot be nil"];
|
||||
|
||||
if (anObject === nil)
|
||||
if (anObject == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"object cannot be nil (key: " + aKey + @")"];
|
||||
|
||||
self.setValueForKey(aKey, anObject);
|
||||
@@ -650,7 +650,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
- (BOOL)containsKey:(id)aKey
|
||||
{
|
||||
var value = [self objectForKey:aKey];
|
||||
return ((value !== nil) && (value !== undefined));
|
||||
return (value != nil);
|
||||
}
|
||||
|
||||
- (void)enumerateKeysAndObjectsUsingBlock:(Function /*(id aKey, id anObject, @ref BOOL stop)*/)aFunction
|
||||
@@ -730,7 +730,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
||||
{
|
||||
var key = [_keyEnumerator nextObject];
|
||||
|
||||
if (key === nil)
|
||||
if (key == nil)
|
||||
return nil;
|
||||
|
||||
return [_dictionary objectForKey:key];
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
@deref(aPartialStringRef) = newString;
|
||||
|
||||
// If a new string is passed back, the selection is always put at the end
|
||||
if (newString !== nil)
|
||||
if (newString != nil)
|
||||
@deref(aProposedSelectedRangeRef) = CPMakeRange(newString.length, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
||||
var key = keys[index],
|
||||
value = [self valueForKey:key];
|
||||
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
[dictionary setObject:[CPNull null] forKey:key];
|
||||
|
||||
else
|
||||
@@ -248,7 +248,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
||||
key,
|
||||
keyEnumerator = [keyedValues keyEnumerator];
|
||||
|
||||
while ((key = [keyEnumerator nextObject]) !== nil)
|
||||
while ((key = [keyEnumerator nextObject]) != nil)
|
||||
{
|
||||
value = [keyedValues objectForKey: key];
|
||||
|
||||
@@ -286,7 +286,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
||||
|
||||
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
||||
{
|
||||
if (aValue !== nil)
|
||||
if (aValue != nil)
|
||||
[self setObject:aValue forKey:aKey];
|
||||
|
||||
else
|
||||
|
||||
@@ -923,7 +923,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
{
|
||||
var oldValue = [_targetObject valueForKey:aKey];
|
||||
|
||||
if (oldValue === nil || oldValue === undefined)
|
||||
if (oldValue == nil)
|
||||
oldValue = [CPNull null];
|
||||
|
||||
[changes setObject:oldValue forKey:CPKeyValueChangeOldKey];
|
||||
@@ -1005,7 +1005,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
{
|
||||
var newValue = [_targetObject valueForKey:aKey];
|
||||
|
||||
if (newValue === nil || newValue === undefined)
|
||||
if (newValue == nil)
|
||||
newValue = [CPNull null];
|
||||
|
||||
[changes setObject:newValue forKey:CPKeyValueChangeNewKey];
|
||||
|
||||
@@ -395,7 +395,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
keys = [aDictionary keyEnumerator],
|
||||
references = @{};
|
||||
|
||||
while ((key = [keys nextObject]) !== nil)
|
||||
while ((key = [keys nextObject]) != nil)
|
||||
[references setObject:_CPKeyedArchiverEncodeObject(self, [aDictionary objectForKey:key], NO) forKey:key];
|
||||
|
||||
[_plistObject setObject:references forKey:aKey];
|
||||
@@ -471,7 +471,7 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
||||
// We wrap primitive JavaScript objects in a unique subclass of CPValue.
|
||||
// This way, when we unarchive, we know to unwrap it, since
|
||||
// _CPKeyedArchiverValue should not be used anywhere else.
|
||||
if (anObject !== nil && anObject !== undefined && !anObject.isa)
|
||||
if (anObject != nil && !anObject.isa)
|
||||
anObject = [_CPKeyedArchiverValue valueWithJSObject:anObject];
|
||||
|
||||
// Get the proper replacement object
|
||||
@@ -479,8 +479,8 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
||||
object = [self._replacementObjects objectForKey:GUID];
|
||||
|
||||
// If a replacement object doesn't exist, then actually ask for one.
|
||||
// Explicitly compare to nil because object could be === 0.
|
||||
if (object === nil)
|
||||
// Explicitly compare to nil and undefined because object could be === 0.
|
||||
if (object == nil)
|
||||
{
|
||||
object = [anObject replacementObjectForKeyedArchiver:self];
|
||||
|
||||
@@ -507,8 +507,8 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
||||
|
||||
// If we still don't have an object by this point, then return a
|
||||
// reference to the null object.
|
||||
// Explicitly compare to nil because object could be === 0.
|
||||
if (object === nil)
|
||||
// Explicitly compare to nil and undefined because object could be === 0.
|
||||
if (object == nil)
|
||||
return _CPKeyedArchiverNullReference;
|
||||
|
||||
// If not, then grab the object's UID
|
||||
@@ -517,13 +517,13 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
||||
// If this object doesn't have a unique index in the object table yet,
|
||||
// then it also hasn't been properly encoded. We explicitly compare
|
||||
// index to nil since it could be 0, which would also evaluate to false.
|
||||
if (UID === nil)
|
||||
if (UID == nil)
|
||||
{
|
||||
// If it is being conditionally encoded, then
|
||||
if (isConditional)
|
||||
{
|
||||
// If we haven't already noted this conditional object...
|
||||
if ((UID = [self._conditionalUIDs objectForKey:GUID]) === nil)
|
||||
if ((UID = [self._conditionalUIDs objectForKey:GUID]) == nil)
|
||||
{
|
||||
// Use the null object as a placeholder.
|
||||
[self._conditionalUIDs setObject:UID = [self._plistObjects count] forKey:GUID];
|
||||
@@ -581,7 +581,7 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
||||
UID = [self._conditionalUIDs objectForKey:GUID];
|
||||
|
||||
// If this object WAS previously encoded conditionally...
|
||||
if (UID !== nil)
|
||||
if (UID != nil)
|
||||
{
|
||||
[self._UIDs setObject:UID forKey:GUID];
|
||||
[self._plistObjects replaceObjectAtIndex:UID withObject:plistObject];
|
||||
|
||||
@@ -253,7 +253,7 @@ var CPArrayClass = Ni
|
||||
{
|
||||
var f = [self decodeObjectForKey:aKey];
|
||||
|
||||
return f === nil ? 0.0 : f;
|
||||
return f == nil ? 0.0 : f;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -265,7 +265,7 @@ var CPArrayClass = Ni
|
||||
{
|
||||
var d = [self decodeObjectForKey:aKey];
|
||||
|
||||
return d === nil ? 0.0 : d;
|
||||
return d == nil ? 0.0 : d;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -277,7 +277,7 @@ var CPArrayClass = Ni
|
||||
{
|
||||
var i = [self decodeObjectForKey:aKey];
|
||||
|
||||
return i === nil ? 0 : i;
|
||||
return i == nil ? 0 : i;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -136,7 +136,7 @@ var CPNotificationDefaultCenter = nil;
|
||||
var name = nil,
|
||||
names = [_namedRegistries keyEnumerator];
|
||||
|
||||
while ((name = [names nextObject]) !== nil)
|
||||
while ((name = [names nextObject]) != nil)
|
||||
[[_namedRegistries objectForKey:name] removeObserver:anObserver object:nil];
|
||||
|
||||
[_unnamedRegistry removeObserver:anObserver object:nil];
|
||||
@@ -155,7 +155,7 @@ var CPNotificationDefaultCenter = nil;
|
||||
var name = nil,
|
||||
names = [_namedRegistries keyEnumerator];
|
||||
|
||||
while ((name = [names nextObject]) !== nil)
|
||||
while ((name = [names nextObject]) != nil)
|
||||
[[_namedRegistries objectForKey:name] removeObserver:anObserver object:anObject];
|
||||
|
||||
[_unnamedRegistry removeObserver:anObserver object:anObject];
|
||||
@@ -258,13 +258,13 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
||||
keys = [_objectObservers keyEnumerator];
|
||||
|
||||
// Iterate through every set of observers
|
||||
while ((key = [keys nextObject]) !== nil)
|
||||
while ((key = [keys nextObject]) != nil)
|
||||
{
|
||||
var observers = [_objectObservers objectForKey:key],
|
||||
observer = nil,
|
||||
observersEnumerator = [observers objectEnumerator];
|
||||
|
||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
||||
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||
if ([observer observer] == anObserver ||
|
||||
([observer block] && [anObserver respondsToSelector:@selector(block)] && [observer block] == [anObserver block]))
|
||||
[observers removeObject:observer];
|
||||
@@ -280,7 +280,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
||||
observer = nil,
|
||||
observersEnumerator = [observers objectEnumerator];
|
||||
|
||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
||||
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||
if ([observer observer] == anObserver ||
|
||||
([observer block] && [anObserver respondsToSelector:@selector(block)] && [observer block] == [anObserver block]))
|
||||
[observers removeObject:observer];
|
||||
@@ -311,7 +311,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
||||
observer = nil,
|
||||
observersEnumerator = [observers objectEnumerator];
|
||||
|
||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
||||
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||
{
|
||||
// CPSet containsObject is N(1) so this is a fast check.
|
||||
if ([currentObservers containsObject:observer])
|
||||
@@ -328,7 +328,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
||||
var observers = [currentObservers copy],
|
||||
observersEnumerator = [observers objectEnumerator];
|
||||
|
||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
||||
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||
{
|
||||
// CPSet containsObject is N(1) so this is a fast check.
|
||||
if ([currentObservers containsObject:observer])
|
||||
|
||||
@@ -314,7 +314,7 @@ FIXME: Do we need this?
|
||||
|
||||
- (CPComparisonResult)compare:(CPNumber)aNumber
|
||||
{
|
||||
if (aNumber === nil || aNumber['isa'] === CPNull)
|
||||
if (aNumber == nil || aNumber['isa'] === CPNull)
|
||||
[CPException raise:CPInvalidArgumentException reason:"nil argument"];
|
||||
|
||||
if (self > aNumber)
|
||||
|
||||
@@ -205,9 +205,9 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
// this will return false if we've received anything but a number, most likely NaN
|
||||
if (!isFinite(value))
|
||||
error = @"Value is not a number";
|
||||
else if (_minimum !== nil && value < _minimum)
|
||||
else if (_minimum != nil && value < _minimum)
|
||||
error = @"Value is less than the minimum allowed value";
|
||||
else if (_maximum !== nil && value > _maximum)
|
||||
else if (_maximum != nil && value > _maximum)
|
||||
error = @"Value is greater than the maximum allowed value";
|
||||
|
||||
if (error)
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
if (self === anObject)
|
||||
return YES;
|
||||
|
||||
if (anObject === nil || anObject.isa !== self.isa || _modifier !== [anObject comparisonPredicateModifier] || _type !== [anObject predicateOperatorType] || _options !== [anObject options] || _customSelector !== [anObject customSelector] || ![_left isEqual:[anObject leftExpression]] || ![_right isEqual:[anObject rightExpression]])
|
||||
if (anObject == nil || anObject.isa !== self.isa || _modifier !== [anObject comparisonPredicateModifier] || _type !== [anObject predicateOperatorType] || _options !== [anObject options] || _customSelector !== [anObject customSelector] || ![_left isEqual:[anObject leftExpression]] || ![_right isEqual:[anObject rightExpression]])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
@@ -388,7 +388,7 @@
|
||||
result = (_modifier == CPAllPredicateModifier),
|
||||
value;
|
||||
|
||||
while ((value = [e nextObject]) !== nil)
|
||||
while ((value = [e nextObject]) != nil)
|
||||
{
|
||||
var eval = [self _evaluateValue:value rightValue:rightValue];
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
if (self === anObject)
|
||||
return YES;
|
||||
|
||||
if (anObject === nil || anObject.isa !== self.isa || _type !== [anObject compoundPredicateType] || ![_predicates isEqualToArray:[anObject subpredicates]])
|
||||
if (anObject == nil || anObject.isa !== self.isa || _type !== [anObject compoundPredicateType] || ![_predicates isEqualToArray:[anObject subpredicates]])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object collection] isEqual:_aggregate])
|
||||
if (object == nil || object.isa !== self.isa || ![[object collection] isEqual:_aggregate])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
{
|
||||
var descriptions = [_aggregate arrayByApplyingBlock:function(exp)
|
||||
{
|
||||
return [exp description];
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || [object expressionBlock] !== _block || ![[object arguments] isEqual:_arguments])
|
||||
if (object == nil || object.isa !== self.isa || [object expressionBlock] !== _block || ![[object arguments] isEqual:_arguments])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object predicate] isEqual:_predicate] || ![[object trueExpression] isEqual:_trueExpression] || ![[object falseExpression] isEqual:_falseExpression])
|
||||
if (object == nil || object.isa !== self.isa || ![[object predicate] isEqual:_predicate] || ![[object trueExpression] isEqual:_trueExpression] || ![[object falseExpression] isEqual:_falseExpression])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object constantValue] isEqual:_value])
|
||||
if (object == nil || object.isa !== self.isa || ![[object constantValue] isEqual:_value])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object _function] isEqual:_selector] || ![[object operand] isEqual:_operand] || ![[object arguments] isEqualToArray:_arguments])
|
||||
if (object == nil || object.isa !== self.isa || ![[object _function] isEqual:_selector] || ![[object operand] isEqual:_operand] || ![[object arguments] isEqualToArray:_arguments])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
if (object === self)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object keyPath] isEqualToString:[self keyPath]])
|
||||
if (object == nil || object.isa !== self.isa || ![[object keyPath] isEqualToString:[self keyPath]])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
if (self === anObject)
|
||||
return YES;
|
||||
|
||||
if (anObject === nil || self.isa !== anObject.isa || _value !== [anObject evaluateWithObject:nil])
|
||||
if (anObject == nil || self.isa !== anObject.isa || _value !== [anObject evaluateWithObject:nil])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object leftExpression] isEqual:_left] || ![[object rightExpression] isEqual:_right])
|
||||
if (object == nil || object.isa !== self.isa || ![[object leftExpression] isEqual:_left] || ![[object rightExpression] isEqual:_right])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![_collection isEqual:[object collection]] || ![_variableExpression isEqual:[object variableExpression]] || ![_subpredicate isEqual:[object predicate]])
|
||||
if (object == nil || object.isa !== self.isa || ![_collection isEqual:[object collection]] || ![_variableExpression isEqual:[object variableExpression]] || ![_subpredicate isEqual:[object predicate]])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
if (self === object)
|
||||
return YES;
|
||||
|
||||
if (object === nil || object.isa !== self.isa || ![[object variable] isEqual:_variable])
|
||||
if (object == nil || object.isa !== self.isa || ![[object variable] isEqual:_variable])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -373,7 +373,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
||||
_didAddTimer = NO;
|
||||
|
||||
// Cancel existing window.setTimeout
|
||||
if (_nativeTimersForModes[aMode] !== nil)
|
||||
if (_nativeTimersForModes[aMode] != nil)
|
||||
{
|
||||
window.clearNativeTimeout(_nativeTimersForModes[aMode]);
|
||||
|
||||
@@ -400,7 +400,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
||||
|
||||
// Timer may or may not still be valid
|
||||
if (timer._isValid)
|
||||
nextFireDate = (nextFireDate === nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
||||
nextFireDate = (nextFireDate == nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
||||
|
||||
else
|
||||
{
|
||||
@@ -425,7 +425,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
||||
var timer = newTimers[index];
|
||||
|
||||
if ([timer isValid])
|
||||
nextFireDate = (nextFireDate === nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
||||
nextFireDate = (nextFireDate == nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
||||
else
|
||||
newTimers.splice(index, 1);
|
||||
}
|
||||
@@ -438,7 +438,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
||||
_nextTimerFireDatesForModes[aMode] = nextFireDate;
|
||||
|
||||
//initiate a new window.setTimeout if there are any timers
|
||||
if (_nextTimerFireDatesForModes[aMode] !== nil)
|
||||
if (_nextTimerFireDatesForModes[aMode] != nil)
|
||||
_nativeTimersForModes[aMode] = window.setNativeTimeout(function()
|
||||
{
|
||||
_effectiveDate = nextFireDate;
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
var object,
|
||||
objectEnumerator = [objects objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
_add(_proxyObject, _addSEL, object);
|
||||
}
|
||||
else
|
||||
@@ -241,7 +241,7 @@
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
_add(_proxyObject, _addSEL, object);
|
||||
}
|
||||
else
|
||||
@@ -278,7 +278,7 @@
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
else
|
||||
@@ -301,7 +301,7 @@
|
||||
var object,
|
||||
objectEnumerator = [objects objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
else
|
||||
@@ -324,7 +324,7 @@
|
||||
var object,
|
||||
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
else
|
||||
@@ -414,11 +414,11 @@
|
||||
containedObjectValue,
|
||||
containedObjectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) !== nil)
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||
{
|
||||
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
|
||||
|
||||
if (containedObjectValue === nil || containedObjectValue === undefined)
|
||||
if (containedObjectValue == nil)
|
||||
containedObjectValue = [CPNull null];
|
||||
|
||||
[valuesForKeySet addObject:containedObjectValue];
|
||||
@@ -433,7 +433,7 @@
|
||||
var containedObject,
|
||||
containedObjectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) !== nil)
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||
[containedObject setValue:aValue forKey:aKey];
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (![aPredicate evaluateWithObject:object])
|
||||
[self removeObject:object];
|
||||
}
|
||||
@@ -72,7 +72,7 @@
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
[self removeObject:object];
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
[self addObject:object];
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
[self removeObject:object];
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
objectsToRemove = [];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (![aSet containsObject:object])
|
||||
objectsToRemove.push(object);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
*/
|
||||
- (void)addObject:(id)anObject
|
||||
{
|
||||
if (anObject === nil || anObject === undefined)
|
||||
if (anObject == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"attempt to insert nil or undefined"];
|
||||
|
||||
if ([self containsObject:anObject])
|
||||
@@ -109,14 +109,14 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
- (void)removeObject:(id)anObject
|
||||
{
|
||||
// Removing nil is an error.
|
||||
if (anObject === nil || anObject === undefined)
|
||||
if (anObject == nil)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"attempt to remove nil or undefined"];
|
||||
|
||||
// anObject might be isEqual: another object in the set. We need the exact instance so we can remove it by UID.
|
||||
var object = [self member:anObject];
|
||||
|
||||
// ...but removing an object not present in the set is not an error.
|
||||
if (object !== nil)
|
||||
if (object != nil)
|
||||
{
|
||||
delete _contents[[object UID]];
|
||||
_count--;
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
objects.push(object);
|
||||
|
||||
return objects;
|
||||
@@ -244,7 +244,7 @@
|
||||
*/
|
||||
- (BOOL)containsObject:(id)anObject
|
||||
{
|
||||
return [self member:anObject] !== nil;
|
||||
return [self member:anObject] != nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -257,7 +257,7 @@
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if ([aPredicate evaluateWithObject:object])
|
||||
objects.push(object);
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
argumentsArray = [nil, aSelector].concat(objects || []);
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
argumentsArray[0] = object;
|
||||
objj_msgSend.apply(this, argumentsArray);
|
||||
@@ -342,7 +342,7 @@
|
||||
object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (aFunction(object))
|
||||
objects.push(object);
|
||||
|
||||
@@ -358,7 +358,7 @@
|
||||
var object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (![aSet containsObject:object])
|
||||
return NO;
|
||||
|
||||
@@ -378,7 +378,7 @@
|
||||
var object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if ([aSet containsObject:object])
|
||||
return YES;
|
||||
|
||||
@@ -477,7 +477,7 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
var value = [object valueForKey:aKey];
|
||||
|
||||
@@ -492,7 +492,7 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
[object setValue:aValue forKey:aKey];
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ var CPStringNull = [CPNull null];
|
||||
*/
|
||||
- (CPComparisonResult)compare:(CPString)aString options:(int)aMask
|
||||
{
|
||||
if (aString === nil)
|
||||
if (aString == nil)
|
||||
return CPOrderedDescending;
|
||||
|
||||
if (aString === CPStringNull)
|
||||
|
||||
@@ -125,7 +125,7 @@ var CPURLConnectionDelegate = nil;
|
||||
key = nil,
|
||||
keys = [fields keyEnumerator];
|
||||
|
||||
while ((key = [keys nextObject]) !== nil)
|
||||
while ((key = [keys nextObject]) != nil)
|
||||
aCFHTTPRequest.setRequestHeader(key, [fields objectForKey:key]);
|
||||
|
||||
aCFHTTPRequest.send([aRequest HTTPBody]);
|
||||
@@ -259,7 +259,7 @@ var CPURLConnectionDelegate = nil;
|
||||
key = nil,
|
||||
keys = [fields keyEnumerator];
|
||||
|
||||
while ((key = [keys nextObject]) !== nil)
|
||||
while ((key = [keys nextObject]) != nil)
|
||||
_HTTPRequest.setRequestHeader(key, [fields objectForKey:key]);
|
||||
|
||||
_HTTPRequest.send([_request HTTPBody]);
|
||||
@@ -274,7 +274,7 @@ var CPURLConnectionDelegate = nil;
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(connection:didFailWithError:)])
|
||||
[_delegate connection:self didFailWithError:anException];
|
||||
else if (_connectionOperation !== nil)
|
||||
else if (_connectionOperation != nil)
|
||||
[self _connectionOperationDidReceiveResponse:nil data:nil error:anException];
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ var CPURLConnectionDelegate = nil;
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(connection:didReceiveData:)])
|
||||
[_delegate connection:self didReceiveData:_HTTPRequest.responseText()];
|
||||
else if (_connectionOperation !== nil)
|
||||
else if (_connectionOperation != nil)
|
||||
[self _connectionOperationDidReceiveResponse:response data:_HTTPRequest.responseText() error:nil];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(connectionDidFinishLoading:)])
|
||||
|
||||
@@ -657,7 +657,7 @@ if (_currentGroup == nil)
|
||||
*/
|
||||
- (void)setActionName:(CPString)anActionName
|
||||
{
|
||||
if (anActionName !== nil && _currentGrouping)
|
||||
if (anActionName != nil && _currentGrouping)
|
||||
[_currentGrouping setActionName:anActionName];
|
||||
}
|
||||
|
||||
@@ -827,7 +827,7 @@ if (_currentGroup == nil)
|
||||
// Don't add no-ops to the undo stack.
|
||||
var before = [aChange valueForKey:CPKeyValueChangeOldKey],
|
||||
after = [aChange valueForKey:CPKeyValueChangeNewKey];
|
||||
if (before === after || (before !== nil && before.isa && (after === nil || after.isa) && [before isEqual:after]))
|
||||
if (before === after || (before != nil && before.isa && (after == nil || after.isa) && [before isEqual:after]))
|
||||
return;
|
||||
|
||||
[[self prepareWithInvocationTarget:anObject]
|
||||
|
||||
@@ -342,7 +342,7 @@ var StandardUserDefaults;
|
||||
var data = [[self persistentStoreForDomain:aDomain] data],
|
||||
domain = data ? [CPKeyedUnarchiver unarchiveObjectWithData:data] : nil;
|
||||
|
||||
if (domain === nil)
|
||||
if (domain == nil)
|
||||
[_domains removeObjectForKey:aDomain];
|
||||
else
|
||||
[_domains setObject:domain forKey:aDomain];
|
||||
@@ -438,7 +438,7 @@ var StandardUserDefaults;
|
||||
- (float)floatForKey:(CPString)aKey
|
||||
{
|
||||
var value = [self objectForKey:aKey];
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
return 0;
|
||||
|
||||
if ([value respondsToSelector:@selector(floatValue)])
|
||||
@@ -453,7 +453,7 @@ var StandardUserDefaults;
|
||||
- (int)integerForKey:(CPString)aKey
|
||||
{
|
||||
var value = [self objectForKey:aKey];
|
||||
if (value === nil)
|
||||
if (value == nil)
|
||||
return 0;
|
||||
|
||||
if ([value respondsToSelector:@selector(intValue)])
|
||||
|
||||
@@ -135,7 +135,7 @@ var transformerMap = @{};
|
||||
|
||||
- (id)transformedValue:(id)aValue
|
||||
{
|
||||
return aValue === nil || aValue === undefined;
|
||||
return aValue == nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -156,7 +156,7 @@ var transformerMap = @{};
|
||||
|
||||
- (id)transformedValue:(id)aValue
|
||||
{
|
||||
return aValue !== nil && aValue !== undefined;
|
||||
return aValue != nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -45,7 +45,7 @@ var setURLResourceValuesForKeysFromProperties = function(aURL, keys, properties)
|
||||
|
||||
var displayName = [properties objectForKey:@"displayname"];
|
||||
|
||||
if (displayName !== nil)
|
||||
if (displayName != nil)
|
||||
{
|
||||
[aURL setResourceValue:displayName forKey:CPURLNameKey];
|
||||
[aURL setResourceValue:displayName forKey:CPURLLocalizedNameKey];
|
||||
@@ -84,7 +84,7 @@ CPWebDAVManagerNonCollectionResourceType = 0;
|
||||
URLString = nil,
|
||||
URLStrings = [response keyEnumerator];
|
||||
|
||||
while ((URLString = [URLStrings nextObject]) !== nil)
|
||||
while ((URLString = [URLStrings nextObject]) != nil)
|
||||
{
|
||||
var URL = [CPURL URLWithString:URLString],
|
||||
properties = [response objectForKey:URLString];
|
||||
|
||||
@@ -52,7 +52,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
||||
enumerator = [objects objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
average += [object doubleValue];
|
||||
|
||||
return average / [objects count];
|
||||
@@ -72,7 +72,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
||||
min = [enumerator nextObject],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([min compare:object] > 0)
|
||||
min = object;
|
||||
@@ -95,7 +95,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
||||
max = [enumerator nextObject],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([max compare:object] < 0)
|
||||
max = object;
|
||||
@@ -114,7 +114,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
||||
enumerator = [objects objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
sum += [object doubleValue];
|
||||
|
||||
return sum;
|
||||
@@ -148,7 +148,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
||||
enumerator = [objects objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([distinctObjects indexOfObject:object] == CPNotFound)
|
||||
[distinctObjects addObject:object];
|
||||
@@ -186,7 +186,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
||||
enumerator = [objects objectEnumerator],
|
||||
object;
|
||||
|
||||
while ((object = [enumerator nextObject]) !== nil)
|
||||
while ((object = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([distinctObjects indexOfObject:object] == CPNotFound)
|
||||
[distinctObjects addObject:object];
|
||||
|
||||
@@ -229,7 +229,7 @@ DISPLAY_NAME(CFMutableDictionary.prototype.replaceValueForKey);
|
||||
|
||||
CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Object*/ aValue)
|
||||
{
|
||||
if (aValue === nil || aValue === undefined)
|
||||
if (aValue == nil)
|
||||
this.removeValueForKey(aKey);
|
||||
|
||||
else if (this.containsKey(aKey))
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
notifications = [],
|
||||
name;
|
||||
|
||||
while ((name = [names nextObject]) !== nil)
|
||||
while ((name = [names nextObject]) != nil)
|
||||
{
|
||||
var notificationRegistry = [defaultCenter._namedRegistries objectForKey:name],
|
||||
objectObservers = notificationRegistry._objectObservers,
|
||||
@@ -19,13 +19,13 @@
|
||||
key;
|
||||
|
||||
// Iterate through every set of observers
|
||||
while ((key = [keys nextObject]) !== nil)
|
||||
while ((key = [keys nextObject]) != nil)
|
||||
{
|
||||
var observers = [objectObservers objectForKey:key],
|
||||
observer = nil,
|
||||
observersEnumerator = [observers objectEnumerator];
|
||||
|
||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
||||
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||
{
|
||||
if ([observer observer] == anObserver)
|
||||
[notifications addObject:name];
|
||||
|
||||
Reference in New Issue
Block a user