Bug 938294 part 4. Add more [Pure] annotations on Node/Element/Document. r=peterv

This commit is contained in:
Boris Zbarsky 2013-11-25 20:59:39 -05:00
parent 5d8a300f60
commit e4913a06ef
3 changed files with 30 additions and 2 deletions

View File

@ -27,17 +27,28 @@ enum VisibilityState { "hidden", "visible" };
interface Document : Node {
[Throws]
readonly attribute DOMImplementation implementation;
[Pure]
readonly attribute DOMString URL;
[Pure]
readonly attribute DOMString documentURI;
[Pure]
readonly attribute DOMString compatMode;
[Pure]
readonly attribute DOMString characterSet;
[Pure]
readonly attribute DOMString contentType;
[Pure]
readonly attribute DocumentType? doctype;
[Pure]
readonly attribute Element? documentElement;
[Pure]
HTMLCollection getElementsByTagName(DOMString localName);
[Pure]
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
[Pure]
HTMLCollection getElementsByClassName(DOMString classNames);
[Pure]
Element? getElementById(DOMString elementId);
[NewObject, Throws]
@ -85,6 +96,7 @@ interface Document : Node {
Attr createAttribute(DOMString name);
[NewObject, Throws]
Attr createAttributeNS(DOMString? namespace, DOMString name);
[Pure]
readonly attribute DOMString? inputEncoding;
};
@ -99,8 +111,9 @@ partial interface Document {
// DOM tree accessors
//(Not proxy yet)getter object (DOMString name);
[SetterThrows]
[SetterThrows, Pure]
attribute DOMString title;
[Pure]
attribute DOMString dir;
//(HTML only) attribute HTMLElement? body;
//(HTML only)readonly attribute HTMLHeadElement? head;
@ -122,6 +135,7 @@ partial interface Document {
//(HTML only)void writeln(DOMString... text);
// user interaction
[Pure]
readonly attribute WindowProxy? defaultView;
readonly attribute Element? activeElement;
[Throws]
@ -157,6 +171,7 @@ partial interface Document {
*
* @see <https://developer.mozilla.org/en/DOM/document.currentScript>
*/
[Pure]
readonly attribute Element? currentScript;
/**
* Release the current mouse capture if it is on an element within this

View File

@ -39,6 +39,7 @@ interface Element : Node {
readonly attribute MozNamedAttrMap attributes;
[Pure]
DOMString? getAttribute(DOMString name);
[Pure]
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[Throws]
void setAttribute(DOMString name, DOMString value);
@ -48,12 +49,16 @@ interface Element : Node {
void removeAttribute(DOMString name);
[Throws]
void removeAttributeNS(DOMString? namespace, DOMString localName);
[Pure]
boolean hasAttribute(DOMString name);
[Pure]
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
[Pure]
HTMLCollection getElementsByTagName(DOMString localName);
[Throws]
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
[Pure]
HTMLCollection getElementsByClassName(DOMString classNames);
/**
@ -71,7 +76,7 @@ interface Element : Node {
readonly attribute float fontSizeInflation;
// Mozilla specific stuff
[Pure]
attribute EventHandler onwheel;
// Selectors API

View File

@ -41,6 +41,7 @@ interface Node : EventTarget {
readonly attribute Node? parentNode;
[Pure]
readonly attribute Element? parentElement;
[Pure]
boolean hasChildNodes();
[SameObject]
readonly attribute NodeList childNodes;
@ -71,6 +72,7 @@ interface Node : EventTarget {
Node cloneNode();
[Throws]
Node cloneNode(boolean deep);
[Pure]
boolean isEqualNode(Node? node);
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
@ -79,11 +81,16 @@ interface Node : EventTarget {
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical
[Pure]
unsigned short compareDocumentPosition(Node other);
[Pure]
boolean contains(Node? other);
[Pure]
DOMString? lookupPrefix(DOMString? namespace);
[Pure]
DOMString? lookupNamespaceURI(DOMString? prefix);
[Pure]
boolean isDefaultNamespace(DOMString? namespace);
// Mozilla-specific stuff
@ -97,6 +104,7 @@ interface Node : EventTarget {
[Constant]
readonly attribute DOMString? localName;
[Pure]
boolean hasAttributes();
[Throws, Func="IsChromeOrXBL"]
any setUserData(DOMString key, any data, UserDataHandler? handler);