Package | cssom.view |
Interface | public interface DocumentView |
Implementors | Document |
Introduced in: | DOM 0 |
Modified in: | DOM 3 Core |
DocumentView contains many properties and a few methods that were previously not part of any specification. They originated as part of MSIE's DHTML object model. They are now all part of the CSSOM Views specification which should be implemented on any browser supporting DOM 3 Core.
All browser compatibility information was obtained via Quirksmode.
Note: This conflicts with an interface in DOM 2 Views. Maybe this specification combined with HTML 5 (for AbstractView) can obsolete that one as it is completely useless in practice.
See also
Method | Defined By | ||
---|---|---|---|
Returns the element from the document whose elementFromPoint method is being called which is the
topmost element which lies under the given point. | DocumentView |
CSSOM View elementFromPoint | () | method |
public function elementFromPoint(x:Number, y:Number):Element
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.1b 3.0 3.1 4.0b 1.0 2.0 9.62 10.0a |
Introduced in: | DOM 0 |
Modified in: | DOM 3 Core |
Returns the element from the document whose elementFromPoint method is being called which is the topmost element which lies under the given point.
The point is specified via coordinates, in CSS pixels, relative to the upper-left-most point in the window or frame containing the document.
Note: If the element at the specified point belongs to another document (for example, an iframe's subdocument), the element in the DOM of the document the method is called on (in the iframe case, the iframe itself) is returned. If the element at the given point is anonymous or XBL generated content, such as a textbox's scroll bars, then the first non-anonymous ancestor element (for example, the textbox) is returned.
Note: If the specified point is outside the visible bounds of the document or either coordinate is negative, the result is null.
Note: The browsers do not entirely agree which mouse coordinates this method needs. IE and Firefox 3 need clientX/Y (relative to the viewport), while Opera and Safari need pageX/Y (relative to the document).
Parameters
x:Number — The X coordinate to check, in CSS pixels relative to the upper-left corner of the document's containing window or frame.
| |
y:Number — The Y coordinate to check, in CSS pixels relative to the upper-left corner of the document's containing window or frame.
|
Element — The element at x,y in the viewport
|
See also
<html> <head> <title>elementFromPoint example</title> <script type="text/javascript"> function changeColor(newColor) { elem = document.elementFromPoint(2, 2); elem.style.color = newColor; } </script> </head> <body> <p id="para1">Some text here</p> <button onclick="changeColor('blue');">blue</button> <button onclick="changeColor('red');">red</button> </body> </html>