mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 02:00:57 +00:00
Merge "Avoid exception when trying to highlight hidden comment"
This commit is contained in:
commit
64f40718e2
|
@ -49,12 +49,15 @@ function highlight( comment ) {
|
||||||
|
|
||||||
var baseRect = $highlight[ 0 ].getBoundingClientRect();
|
var baseRect = $highlight[ 0 ].getBoundingClientRect();
|
||||||
var rect = RangeFix.getBoundingClientRect( range );
|
var rect = RangeFix.getBoundingClientRect( range );
|
||||||
|
// rect may be null if the range is in a detached or hidden node
|
||||||
|
if ( rect ) {
|
||||||
$highlight.css( {
|
$highlight.css( {
|
||||||
'margin-top': rect.top - baseRect.top - padding,
|
'margin-top': rect.top - baseRect.top - padding,
|
||||||
'margin-left': rect.left - baseRect.left - padding,
|
'margin-left': rect.left - baseRect.left - padding,
|
||||||
width: rect.width + ( padding * 2 ),
|
width: rect.width + ( padding * 2 ),
|
||||||
height: rect.height + ( padding * 2 )
|
height: rect.height + ( padding * 2 )
|
||||||
} );
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
return $highlight;
|
return $highlight;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue