mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Override jQuery.contains instead of jQuery.fn.position
Turns out the problems with position inside the shadow DOM are due to the fact that elements in the light DOM don’t claim to contain elements from a shadow DOM, causing jQuery.fn.offset to bail out early and misreport positions inside the editor.
This commit is contained in:
@@ -78,10 +78,17 @@ jQuery.event.remove = (elem, types, originalHandler, selector, mappedTypes) ->
|
||||
handler = HandlersByOriginalHandler.get(originalHandler) ? originalHandler
|
||||
JQueryEventRemove(elem, types, handler, selector, mappedTypes, RemoveEventListener if atom?.commands?)
|
||||
|
||||
jQuery.fn.position = ->
|
||||
top = @[0].offsetTop
|
||||
left = @[0].offsetLeft
|
||||
{top, left}
|
||||
JQueryContains = jQuery.contains
|
||||
|
||||
jQuery.contains = (a, b) ->
|
||||
shadowRoot = null
|
||||
currentNode = b
|
||||
while currentNode
|
||||
if currentNode instanceof ShadowRoot and a.contains(currentNode.host)
|
||||
return true
|
||||
currentNode = currentNode.parentNode
|
||||
|
||||
JQueryContains.call(this, a, b)
|
||||
|
||||
tooltipDefaults =
|
||||
delay:
|
||||
|
||||
Reference in New Issue
Block a user