2012-03-30 21:42:20 -07:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
2012-10-16 04:51:00 -07:00
|
|
|
* http://dom.spec.whatwg.org/#element and
|
|
|
|
* http://domparsing.spec.whatwg.org/ and
|
|
|
|
* http://dev.w3.org/csswg/cssom-view/ and
|
|
|
|
* http://www.w3.org/TR/selectors-api/
|
2012-03-30 21:42:20 -07:00
|
|
|
*
|
|
|
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
|
|
|
* liability, trademark and document use rules apply.
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface Element : Node {
|
2012-10-16 04:51:00 -07:00
|
|
|
/*
|
|
|
|
We haven't moved these from Node to Element like the spec wants.
|
|
|
|
|
|
|
|
[Throws]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute DOMString? namespaceURI;
|
|
|
|
readonly attribute DOMString? prefix;
|
|
|
|
readonly attribute DOMString localName;
|
2012-10-16 04:51:00 -07:00
|
|
|
*/
|
2012-12-25 14:00:15 -08:00
|
|
|
// Not [Constant] because it depends on which document we're in
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute DOMString tagName;
|
|
|
|
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
attribute DOMString id;
|
2014-05-30 00:36:53 -07:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
attribute DOMString className;
|
2012-12-25 14:00:15 -08:00
|
|
|
[Constant]
|
2014-05-30 00:36:53 -07:00
|
|
|
readonly attribute DOMTokenList classList;
|
2012-03-30 21:42:20 -07:00
|
|
|
|
2013-08-28 21:30:05 -07:00
|
|
|
[SameObject]
|
2014-08-25 02:25:34 -07:00
|
|
|
readonly attribute NamedNodeMap attributes;
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2015-12-02 13:04:53 -08:00
|
|
|
sequence<DOMString> getAttributeNames();
|
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
DOMString? getAttribute(DOMString name);
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2012-03-30 21:42:20 -07:00
|
|
|
void setAttribute(DOMString name, DOMString value);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2012-03-30 21:42:20 -07:00
|
|
|
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2012-03-30 21:42:20 -07:00
|
|
|
void removeAttribute(DOMString name);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2012-03-30 21:42:20 -07:00
|
|
|
void removeAttributeNS(DOMString? namespace, DOMString localName);
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
boolean hasAttribute(DOMString name);
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
|
2014-10-01 01:16:00 -07:00
|
|
|
[Pure]
|
|
|
|
boolean hasAttributes();
|
2012-03-30 21:42:20 -07:00
|
|
|
|
2014-09-13 06:08:00 -07:00
|
|
|
[Throws, Pure]
|
|
|
|
Element? closest(DOMString selector);
|
|
|
|
|
2014-08-01 20:37:09 -07:00
|
|
|
[Throws, Pure]
|
|
|
|
boolean matches(DOMString selector);
|
2015-10-19 17:18:09 -07:00
|
|
|
[Throws, Pure, BinaryName="matches"]
|
|
|
|
boolean webkitMatchesSelector(DOMString selector);
|
2014-08-01 20:37:09 -07:00
|
|
|
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2012-10-16 04:51:00 -07:00
|
|
|
HTMLCollection getElementsByTagName(DOMString localName);
|
2013-12-02 06:50:34 -08:00
|
|
|
[Throws, Pure]
|
2012-10-16 04:51:00 -07:00
|
|
|
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2012-10-16 04:51:00 -07:00
|
|
|
HTMLCollection getElementsByClassName(DOMString classNames);
|
2012-03-30 21:42:20 -07:00
|
|
|
|
2013-07-02 07:04:27 -07:00
|
|
|
/**
|
|
|
|
* The ratio of font-size-inflated text font size to computed font
|
|
|
|
* size for this element. This will query the element for its primary frame,
|
|
|
|
* and then use this to get font size inflation information about the frame.
|
|
|
|
* This will be 1.0 if font size inflation is not enabled, and -1.0 if an
|
|
|
|
* error occurred during the retrieval of the font size inflation.
|
|
|
|
*
|
|
|
|
* @note The font size inflation ratio that is returned is actually the
|
|
|
|
* font size inflation data for the element's _primary frame_, not the
|
|
|
|
* element itself, but for most purposes, this should be sufficient.
|
|
|
|
*/
|
|
|
|
[ChromeOnly]
|
|
|
|
readonly attribute float fontSizeInflation;
|
|
|
|
|
2012-10-16 04:51:00 -07:00
|
|
|
// Mozilla specific stuff
|
2013-11-25 17:59:39 -08:00
|
|
|
[Pure]
|
2012-11-22 03:09:43 -08:00
|
|
|
attribute EventHandler onwheel;
|
|
|
|
|
2012-10-16 04:51:00 -07:00
|
|
|
// Selectors API
|
|
|
|
/**
|
|
|
|
* Returns whether this element would be selected by the given selector
|
|
|
|
* string.
|
|
|
|
*
|
|
|
|
* See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector>
|
|
|
|
*/
|
2015-10-19 17:18:09 -07:00
|
|
|
[Throws, Pure, BinaryName="matches"]
|
2012-10-16 04:51:00 -07:00
|
|
|
boolean mozMatchesSelector(DOMString selector);
|
|
|
|
|
2014-04-04 10:09:10 -07:00
|
|
|
// Pointer events methods.
|
2014-12-21 08:59:48 -08:00
|
|
|
[Throws, Pref="dom.w3c_pointer_events.enabled", UnsafeInPrerendering]
|
2014-04-04 10:09:10 -07:00
|
|
|
void setPointerCapture(long pointerId);
|
|
|
|
|
|
|
|
[Throws, Pref="dom.w3c_pointer_events.enabled"]
|
|
|
|
void releasePointerCapture(long pointerId);
|
|
|
|
|
2012-10-16 04:51:00 -07:00
|
|
|
// Proprietary extensions
|
|
|
|
/**
|
|
|
|
* Set this during a mousedown event to grab and retarget all mouse events
|
|
|
|
* to this element until the mouse button is released or releaseCapture is
|
|
|
|
* called. If retargetToElement is true, then all events are targetted at
|
|
|
|
* this element. If false, events can also fire at descendants of this
|
|
|
|
* element.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void setCapture(optional boolean retargetToElement = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If this element has captured the mouse, release the capture. If another
|
|
|
|
* element has captured the mouse, this method has no effect.
|
|
|
|
*/
|
|
|
|
void releaseCapture();
|
|
|
|
|
|
|
|
// Mozilla extensions
|
|
|
|
/**
|
|
|
|
* Requests that this element be made the full-screen element, as per the DOM
|
|
|
|
* full-screen api.
|
|
|
|
*
|
2015-01-05 11:49:04 -08:00
|
|
|
* The options parameter is non-standard. In Gecko, it can be:
|
|
|
|
* a RequestFullscreenOptions object
|
2014-07-09 12:30:22 -07:00
|
|
|
*
|
2012-10-16 04:51:00 -07:00
|
|
|
* @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
|
|
|
|
*/
|
2015-01-05 11:49:04 -08:00
|
|
|
[Throws, UnsafeInPrerendering]
|
|
|
|
void mozRequestFullScreen(optional any options);
|
2012-10-16 04:51:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Requests that this element be made the pointer-locked element, as per the DOM
|
|
|
|
* pointer lock api.
|
|
|
|
*
|
|
|
|
* @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
|
|
|
|
*/
|
2014-12-21 08:59:48 -08:00
|
|
|
[UnsafeInPrerendering]
|
2012-10-16 04:51:00 -07:00
|
|
|
void mozRequestPointerLock();
|
|
|
|
|
|
|
|
// Obsolete methods.
|
2013-04-09 08:29:47 -07:00
|
|
|
Attr? getAttributeNode(DOMString name);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2013-04-09 08:29:47 -07:00
|
|
|
Attr? setAttributeNode(Attr newAttr);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2013-04-09 08:29:47 -07:00
|
|
|
Attr? removeAttributeNode(Attr oldAttr);
|
|
|
|
Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
|
2012-10-16 04:51:00 -07:00
|
|
|
[Throws]
|
2013-04-09 08:29:47 -07:00
|
|
|
Attr? setAttributeNodeNS(Attr newAttr);
|
2013-09-30 10:32:02 -07:00
|
|
|
|
|
|
|
[ChromeOnly]
|
|
|
|
/**
|
|
|
|
* Scrolls the element by (dx, dy) CSS pixels without doing any
|
|
|
|
* layout flushing.
|
|
|
|
*/
|
|
|
|
boolean scrollByNoFlush(long dx, long dy);
|
2012-10-16 04:51:00 -07:00
|
|
|
};
|
|
|
|
|
Bug 1045754 - Part 1 - Implement updated CSSOM-View smooth-scrolling specification. r=bz
- Added new WebIDL dictionary, ScrollToOptions. This dictionary extends
ScrollOptions by adding "left" and "top", specifying the scroll offset.
This will be later extended with more members to allow scroll offsets to be
specified with logical axes.
- Implemented Window.Scroll, Window.ScrollTo, Window.ScrollBy, Element.Scroll,
Element.ScrollTo, and Element.ScrollBy functions that accept ScrollToOptions
as a single parameter.
- Removed ScrollOptions dictionary parameter from existing Window.Scroll,
Window.ScrollTo, and Window.ScrollBy functions as these have been replaced
with functions accepting a single parameter, ScrollToOptions.
- Added new WebIDL dictionary, ScrollIntoViewOptions. This dictionary
extends ScrollOptions by adding "block", specifying whether the element
start or end will be scrolled into view.
- Replaced Element.ScrollIntoView(bool,ScrollOptions) with
Element.ScrollIntoView(ScrollIntoViewOptions) to match updated
CSSOM-View scroll-behavior specification.
2014-10-01 10:47:56 -07:00
|
|
|
// http://dev.w3.org/csswg/cssom-view/
|
|
|
|
enum ScrollLogicalPosition { "start", "end" };
|
|
|
|
dictionary ScrollIntoViewOptions : ScrollOptions {
|
|
|
|
ScrollLogicalPosition block = "start";
|
|
|
|
};
|
|
|
|
|
2012-10-16 04:51:00 -07:00
|
|
|
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
|
|
|
|
partial interface Element {
|
2013-09-20 03:21:03 -07:00
|
|
|
DOMRectList getClientRects();
|
|
|
|
DOMRect getBoundingClientRect();
|
2012-10-16 04:51:00 -07:00
|
|
|
|
|
|
|
// scrolling
|
Bug 1045754 - Part 1 - Implement updated CSSOM-View smooth-scrolling specification. r=bz
- Added new WebIDL dictionary, ScrollToOptions. This dictionary extends
ScrollOptions by adding "left" and "top", specifying the scroll offset.
This will be later extended with more members to allow scroll offsets to be
specified with logical axes.
- Implemented Window.Scroll, Window.ScrollTo, Window.ScrollBy, Element.Scroll,
Element.ScrollTo, and Element.ScrollBy functions that accept ScrollToOptions
as a single parameter.
- Removed ScrollOptions dictionary parameter from existing Window.Scroll,
Window.ScrollTo, and Window.ScrollBy functions as these have been replaced
with functions accepting a single parameter, ScrollToOptions.
- Added new WebIDL dictionary, ScrollIntoViewOptions. This dictionary
extends ScrollOptions by adding "block", specifying whether the element
start or end will be scrolled into view.
- Replaced Element.ScrollIntoView(bool,ScrollOptions) with
Element.ScrollIntoView(ScrollIntoViewOptions) to match updated
CSSOM-View scroll-behavior specification.
2014-10-01 10:47:56 -07:00
|
|
|
void scrollIntoView(boolean top);
|
|
|
|
void scrollIntoView(optional ScrollIntoViewOptions options);
|
2013-01-29 14:53:53 -08:00
|
|
|
// None of the CSSOM attributes are [Pure], because they flush
|
2012-10-16 04:51:00 -07:00
|
|
|
attribute long scrollTop; // scroll on setting
|
|
|
|
attribute long scrollLeft; // scroll on setting
|
|
|
|
readonly attribute long scrollWidth;
|
|
|
|
readonly attribute long scrollHeight;
|
Bug 1045754 - Part 1 - Implement updated CSSOM-View smooth-scrolling specification. r=bz
- Added new WebIDL dictionary, ScrollToOptions. This dictionary extends
ScrollOptions by adding "left" and "top", specifying the scroll offset.
This will be later extended with more members to allow scroll offsets to be
specified with logical axes.
- Implemented Window.Scroll, Window.ScrollTo, Window.ScrollBy, Element.Scroll,
Element.ScrollTo, and Element.ScrollBy functions that accept ScrollToOptions
as a single parameter.
- Removed ScrollOptions dictionary parameter from existing Window.Scroll,
Window.ScrollTo, and Window.ScrollBy functions as these have been replaced
with functions accepting a single parameter, ScrollToOptions.
- Added new WebIDL dictionary, ScrollIntoViewOptions. This dictionary
extends ScrollOptions by adding "block", specifying whether the element
start or end will be scrolled into view.
- Replaced Element.ScrollIntoView(bool,ScrollOptions) with
Element.ScrollIntoView(ScrollIntoViewOptions) to match updated
CSSOM-View scroll-behavior specification.
2014-10-01 10:47:56 -07:00
|
|
|
|
|
|
|
void scroll(unrestricted double x, unrestricted double y);
|
|
|
|
void scroll(optional ScrollToOptions options);
|
|
|
|
void scrollTo(unrestricted double x, unrestricted double y);
|
|
|
|
void scrollTo(optional ScrollToOptions options);
|
|
|
|
void scrollBy(unrestricted double x, unrestricted double y);
|
|
|
|
void scrollBy(optional ScrollToOptions options);
|
2015-02-19 16:03:07 -08:00
|
|
|
// mozScrollSnap is used by chrome to perform scroll snapping after the
|
|
|
|
// user performs actions that may affect scroll position
|
|
|
|
// mozScrollSnap is deprecated, to be replaced by a web accessible API, such
|
|
|
|
// as an extension to the ScrollOptions dictionary. See bug 1137937.
|
|
|
|
[ChromeOnly] void mozScrollSnap();
|
2012-10-16 04:51:00 -07:00
|
|
|
|
|
|
|
readonly attribute long clientTop;
|
|
|
|
readonly attribute long clientLeft;
|
|
|
|
readonly attribute long clientWidth;
|
|
|
|
readonly attribute long clientHeight;
|
|
|
|
|
|
|
|
// Mozilla specific stuff
|
2015-10-26 21:38:02 -07:00
|
|
|
/* The minimum/maximum offset that the element can be scrolled to
|
2012-10-16 04:51:00 -07:00
|
|
|
(i.e., the value that scrollLeft/scrollTop would be clamped to if they were
|
|
|
|
set to arbitrarily large values. */
|
2015-10-26 21:38:02 -07:00
|
|
|
[ChromeOnly] readonly attribute long scrollTopMin;
|
|
|
|
readonly attribute long scrollTopMax;
|
|
|
|
[ChromeOnly] readonly attribute long scrollLeftMin;
|
|
|
|
readonly attribute long scrollLeftMax;
|
2012-10-16 04:51:00 -07:00
|
|
|
};
|
|
|
|
|
2013-01-03 22:54:26 -08:00
|
|
|
// http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
|
|
|
|
partial interface Element {
|
|
|
|
[Pref="dom.undo_manager.enabled"]
|
|
|
|
readonly attribute UndoManager? undoManager;
|
|
|
|
[SetterThrows,Pref="dom.undo_manager.enabled"]
|
|
|
|
attribute boolean undoScope;
|
|
|
|
};
|
|
|
|
|
2012-10-16 04:51:00 -07:00
|
|
|
// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
|
|
|
|
partial interface Element {
|
2013-10-08 12:25:01 -07:00
|
|
|
[Pure,SetterThrows,TreatNullAs=EmptyString]
|
2012-10-16 04:51:00 -07:00
|
|
|
attribute DOMString innerHTML;
|
2013-10-08 12:25:01 -07:00
|
|
|
[Pure,SetterThrows,TreatNullAs=EmptyString]
|
2012-10-16 04:51:00 -07:00
|
|
|
attribute DOMString outerHTML;
|
|
|
|
[Throws]
|
2012-12-23 18:38:41 -08:00
|
|
|
void insertAdjacentHTML(DOMString position, DOMString text);
|
2012-10-16 04:51:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// http://www.w3.org/TR/selectors-api/#interface-definitions
|
|
|
|
partial interface Element {
|
2013-12-02 06:50:34 -08:00
|
|
|
[Throws, Pure]
|
2012-10-16 04:51:00 -07:00
|
|
|
Element? querySelector(DOMString selectors);
|
2013-12-02 06:50:34 -08:00
|
|
|
[Throws, Pure]
|
2012-10-16 04:51:00 -07:00
|
|
|
NodeList querySelectorAll(DOMString selectors);
|
2012-03-30 21:42:20 -07:00
|
|
|
};
|
2013-04-13 00:08:47 -07:00
|
|
|
|
2014-05-21 23:11:53 -07:00
|
|
|
// http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-element-interface
|
2013-12-02 02:26:11 -08:00
|
|
|
partial interface Element {
|
2014-07-07 19:02:03 -07:00
|
|
|
[Throws,Func="nsDocument::IsWebComponentsEnabled"]
|
2013-12-02 02:26:11 -08:00
|
|
|
ShadowRoot createShadowRoot();
|
2014-07-07 19:02:03 -07:00
|
|
|
[Func="nsDocument::IsWebComponentsEnabled"]
|
2014-05-21 23:11:53 -07:00
|
|
|
NodeList getDestinationInsertionPoints();
|
2014-07-07 19:02:03 -07:00
|
|
|
[Func="nsDocument::IsWebComponentsEnabled"]
|
2013-12-02 02:26:11 -08:00
|
|
|
readonly attribute ShadowRoot? shadowRoot;
|
|
|
|
};
|
|
|
|
|
2013-04-13 00:08:47 -07:00
|
|
|
Element implements ChildNode;
|
2013-11-16 21:10:19 -08:00
|
|
|
Element implements NonDocumentTypeChildNode;
|
2013-07-22 05:15:43 -07:00
|
|
|
Element implements ParentNode;
|
2014-07-15 17:02:31 -07:00
|
|
|
Element implements Animatable;
|
2014-09-24 06:11:29 -07:00
|
|
|
Element implements GeometryUtils;
|
2014-07-09 12:30:22 -07:00
|
|
|
|
|
|
|
// non-standard: allows passing options to Element.requestFullScreen
|
|
|
|
dictionary RequestFullscreenOptions {
|
|
|
|
// Which HMDVRDevice to go full screen on; also enables VR rendering.
|
|
|
|
// If null, normal fullscreen is entered.
|
|
|
|
HMDVRDevice? vrDisplay = null;
|
|
|
|
};
|