Skip to content

Commit

Permalink
Wrap _DOMElement access in #if PLATFORM(DOM), cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aparajita committed Jul 10, 2012
1 parent a8d1224 commit a3d4dc2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions AppKit/CPView.j
Expand Up @@ -246,8 +246,8 @@ var CPCurrentToolTip,
- (void)_setupToolTipHandlers
{
_toolTipInstalled = NO;
_toolTipFunctionIn = function(e){[self _fireToolTip];}
_toolTipFunctionOut = function(e){[self _invalidateToolTip];};
_toolTipFunctionIn = function(e) { [self _fireToolTip]; }
_toolTipFunctionOut = function(e) { [self _invalidateToolTip]; };
}

+ (CPSet)keyPathsForValuesAffectingFrame
Expand Down Expand Up @@ -353,6 +353,7 @@ var CPCurrentToolTip,
if (_toolTipInstalled)
return;

#if PLATFORM(DOM)
if (_DOMElement.addEventListener)
{
_DOMElement.addEventListener("mouseover", _toolTipFunctionIn, NO);
Expand All @@ -365,6 +366,8 @@ var CPCurrentToolTip,
_DOMElement.attachEvent("onkeypress", _toolTipFunctionOut);
_DOMElement.attachEvent("onmouseout", _toolTipFunctionOut);
}
#endif

_toolTipInstalled = YES;
}

Expand All @@ -377,6 +380,7 @@ var CPCurrentToolTip,
if (!_toolTipInstalled)
return;

#if PLATFORM(DOM)
if (_DOMElement.removeEventListener)
{
_DOMElement.removeEventListener("mouseover", _toolTipFunctionIn, NO);
Expand All @@ -389,6 +393,8 @@ var CPCurrentToolTip,
_DOMElement.detachEvent("onkeypress", _toolTipFunctionOut);
_DOMElement.detachEvent("onmouseout", _toolTipFunctionOut);
}
#endif

_toolTipInstalled = NO;
}

Expand All @@ -400,8 +406,10 @@ var CPCurrentToolTip,
if (CPCurrentToolTipTimer)
{
[CPCurrentToolTipTimer invalidate];

if (CPCurrentToolTip)
[CPCurrentToolTip close];

CPCurrentToolTip = nil;
}

Expand Down Expand Up @@ -434,6 +442,7 @@ var CPCurrentToolTip,
{
if (CPCurrentToolTip)
[CPCurrentToolTip close];

CPCurrentToolTip = [_CPToolTip toolTipWithString:_toolTip];
}

Expand Down

0 comments on commit a3d4dc2

Please sign in to comment.