Hey guys, I'm writing a Firefox plugin and using the following function:
var obj = page.elementFromPoint(x,y); //x,y are the mouse coordinates
However this function returns the topmost element which lies under the given point. This isn't good enough for me, I need the most inner element which lies under the given point. Does anyone know how to do it?
Thanks开发者_JS百科
Gecko and WebKit support the style pointer-events: none;
to prevent pointer events on the element obscuring the one you want to find, but generally you can only manually search the DOM tree. Or set display: none;
to the elements you don't want to get before you use elementFromPoint
, if that is possible in your setup.
精彩评论