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.
|
|
|
|
*/
|
|
|
|
|
2013-03-17 01:51:34 -07:00
|
|
|
interface MozNamedAttrMap;
|
2012-10-16 04:51:00 -07:00
|
|
|
|
2012-03-30 21:42:20 -07:00
|
|
|
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;
|
2012-10-16 04:51:00 -07:00
|
|
|
/*
|
|
|
|
FIXME Bug 810677 Move className from HTMLElement to Element
|
2012-03-30 21:42:20 -07:00
|
|
|
attribute DOMString className;
|
2012-10-16 04:51:00 -07:00
|
|
|
*/
|
2012-12-25 14:00:15 -08:00
|
|
|
[Constant]
|
2012-11-22 03:09:43 -08:00
|
|
|
readonly attribute DOMTokenList? classList;
|
2012-03-30 21:42:20 -07:00
|
|
|
|
2013-03-17 01:51:34 -07:00
|
|
|
[Constant]
|
|
|
|
readonly attribute MozNamedAttrMap attributes;
|
2012-03-30 21:42:20 -07:00
|
|
|
DOMString? getAttribute(DOMString name);
|
|
|
|
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);
|
|
|
|
boolean hasAttribute(DOMString name);
|
|
|
|
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
|
|
|
|
|
2012-10-16 04:51:00 -07:00
|
|
|
HTMLCollection getElementsByTagName(DOMString localName);
|
|
|
|
[Throws]
|
|
|
|
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
|
|
|
HTMLCollection getElementsByClassName(DOMString classNames);
|
2012-03-30 21:42:20 -07:00
|
|
|
|
2012-12-25 14:00:15 -08:00
|
|
|
[Constant]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute HTMLCollection children;
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute Element? firstElementChild;
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute Element? lastElementChild;
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute Element? previousElementSibling;
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute Element? nextElementSibling;
|
2013-01-29 14:53:53 -08:00
|
|
|
[Pure]
|
2012-03-30 21:42:20 -07:00
|
|
|
readonly attribute unsigned long childElementCount;
|
|
|
|
|
|
|
|
// NEW
|
2012-10-16 04:51:00 -07:00
|
|
|
/*
|
|
|
|
FIXME We haven't implemented these yet.
|
|
|
|
|
2012-03-30 21:42:20 -07:00
|
|
|
void prepend((Node or DOMString)... nodes);
|
|
|
|
void append((Node or DOMString)... nodes);
|
|
|
|
void before((Node or DOMString)... nodes);
|
|
|
|
void after((Node or DOMString)... nodes);
|
|
|
|
void replace((Node or DOMString)... nodes);
|
|
|
|
void remove();
|
2012-10-16 04:51:00 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Mozilla specific stuff
|
|
|
|
|
2012-11-22 03:09:43 -08:00
|
|
|
[SetterThrows,LenientThis]
|
|
|
|
attribute EventHandler onmouseenter;
|
|
|
|
[SetterThrows,LenientThis]
|
|
|
|
attribute EventHandler onmouseleave;
|
|
|
|
[SetterThrows]
|
|
|
|
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>
|
|
|
|
*/
|
|
|
|
[Throws]
|
|
|
|
boolean mozMatchesSelector(DOMString selector);
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
*
|
|
|
|
* @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
|
|
|
|
*/
|
|
|
|
void mozRequestFullScreen();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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>
|
|
|
|
*/
|
|
|
|
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);
|
2012-10-16 04:51:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
|
|
|
|
partial interface Element {
|
|
|
|
ClientRectList getClientRects();
|
|
|
|
ClientRect getBoundingClientRect();
|
|
|
|
|
|
|
|
// scrolling
|
|
|
|
void scrollIntoView(optional boolean top = true);
|
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;
|
|
|
|
|
|
|
|
readonly attribute long clientTop;
|
|
|
|
readonly attribute long clientLeft;
|
|
|
|
readonly attribute long clientWidth;
|
|
|
|
readonly attribute long clientHeight;
|
|
|
|
|
|
|
|
// Mozilla specific stuff
|
|
|
|
/* The maximum offset that the element can be scrolled to
|
|
|
|
(i.e., the value that scrollLeft/scrollTop would be clamped to if they were
|
|
|
|
set to arbitrarily large values. */
|
|
|
|
readonly attribute long scrollTopMax;
|
|
|
|
readonly attribute long scrollLeftMax;
|
|
|
|
};
|
|
|
|
|
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 {
|
2012-12-23 18:38:41 -08:00
|
|
|
[Throws,TreatNullAs=EmptyString]
|
2012-10-16 04:51:00 -07:00
|
|
|
attribute DOMString innerHTML;
|
2012-12-23 18:38:41 -08:00
|
|
|
[Throws,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 {
|
|
|
|
[Throws]
|
|
|
|
Element? querySelector(DOMString selectors);
|
|
|
|
[Throws]
|
|
|
|
NodeList querySelectorAll(DOMString selectors);
|
2012-03-30 21:42:20 -07:00
|
|
|
};
|