Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. // DOM core WebIDL
  2. // retrived from http://dom.spec.whatwg.org/
  3. // 23rd October 2012
  4.  
  5.  
  6.  
  7. exception DOMException {
  8.   const unsigned short INDEX_SIZE_ERR = 1;
  9.   const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
  10.   const unsigned short HIERARCHY_REQUEST_ERR = 3;
  11.   const unsigned short WRONG_DOCUMENT_ERR = 4;
  12.   const unsigned short INVALID_CHARACTER_ERR = 5;
  13.   const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
  14.   const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
  15.   const unsigned short NOT_FOUND_ERR = 8;
  16.   const unsigned short NOT_SUPPORTED_ERR = 9;
  17.   const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical
  18.   const unsigned short INVALID_STATE_ERR = 11;
  19.   const unsigned short SYNTAX_ERR = 12;
  20.   const unsigned short INVALID_MODIFICATION_ERR = 13;
  21.   const unsigned short NAMESPACE_ERR = 14;
  22.   const unsigned short INVALID_ACCESS_ERR = 15;
  23.   const unsigned short VALIDATION_ERR = 16; // historical
  24.   const unsigned short TYPE_MISMATCH_ERR = 17;
  25.   const unsigned short SECURITY_ERR = 18;
  26.   const unsigned short NETWORK_ERR = 19;
  27.   const unsigned short ABORT_ERR = 20;
  28.   const unsigned short URL_MISMATCH_ERR = 21;
  29.   const unsigned short QUOTA_EXCEEDED_ERR = 22;
  30.   const unsigned short TIMEOUT_ERR = 23;
  31.   const unsigned short INVALID_NODE_TYPE_ERR = 24;
  32.   const unsigned short DATA_CLONE_ERR = 25;
  33.   unsigned short code;
  34. };
  35.  
  36. interface DOMError {
  37.   readonly attribute DOMString name;
  38. };
  39.  
  40. [Constructor(DOMString type, optional EventInit eventInitDict)]
  41. interface Event {
  42.   readonly attribute DOMString type;
  43.   readonly attribute EventTarget? target;
  44.   readonly attribute EventTarget? currentTarget;
  45.  
  46.   const unsigned short NONE = 0;
  47.   const unsigned short CAPTURING_PHASE = 1;
  48.   const unsigned short AT_TARGET = 2;
  49.   const unsigned short BUBBLING_PHASE = 3;
  50.   readonly attribute unsigned short eventPhase;
  51.  
  52.   void stopPropagation();
  53.   void stopImmediatePropagation();
  54.  
  55.   readonly attribute boolean bubbles;
  56.   readonly attribute boolean cancelable;
  57.   void preventDefault();
  58.   readonly attribute boolean defaultPrevented;
  59.  
  60.   readonly attribute boolean isTrusted;
  61.   readonly attribute DOMTimeStamp timeStamp;
  62.  
  63.   void initEvent(DOMString type, boolean bubbles, boolean cancelable);
  64. };
  65.  
  66. dictionary EventInit {
  67.   boolean bubbles;
  68.   boolean cancelable;
  69. };
  70.  
  71. [Constructor(DOMString type, optional CustomEventInit eventInitDict)]
  72. interface CustomEvent : Event {
  73.   readonly attribute any detail;
  74. };
  75.  
  76. dictionary CustomEventInit : EventInit {
  77.   any detail;
  78. };
  79.  
  80. interface EventTarget {
  81.   void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
  82.   void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
  83.   boolean dispatchEvent(Event event);
  84. };
  85.  
  86. callback interface EventListener {
  87.   void handleEvent(Event event);
  88. };
  89.  
  90. [Constructor(MutationCallback callback)]
  91. interface MutationObserver {
  92.   void observe(Node target, MutationObserverInit options);
  93.   void disconnect();
  94.   sequence<MutationRecord> takeRecords();
  95. };
  96.  
  97. callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
  98.  
  99. dictionary MutationObserverInit {
  100.   boolean childList;
  101.   boolean attributes;
  102.   boolean characterData;
  103.   boolean subtree;
  104.   boolean attributeOldValue;
  105.   boolean characterDataOldValue;
  106.   sequence<DOMString> attributeFilter;
  107. };
  108.  
  109. interface MutationRecord {
  110.   readonly attribute DOMString type;
  111.   readonly attribute Node target;
  112.   readonly attribute NodeList addedNodes;
  113.   readonly attribute NodeList removedNodes;
  114.   readonly attribute Node? previousSibling;
  115.   readonly attribute Node? nextSibling;
  116.   readonly attribute DOMString? attributeName;
  117.   readonly attribute DOMString? attributeNamespace;
  118.   readonly attribute DOMString? oldValue;
  119. };
  120.  
  121. interface Node : EventTarget {
  122.   const unsigned short ELEMENT_NODE = 1;
  123.   const unsigned short ATTRIBUTE_NODE = 2; // historical
  124.   const unsigned short TEXT_NODE = 3;
  125.   const unsigned short CDATA_SECTION_NODE = 4; // historical
  126.   const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
  127.   const unsigned short ENTITY_NODE = 6; // historical
  128.   const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
  129.   const unsigned short COMMENT_NODE = 8;
  130.   const unsigned short DOCUMENT_NODE = 9;
  131.   const unsigned short DOCUMENT_TYPE_NODE = 10;
  132.   const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
  133.   const unsigned short NOTATION_NODE = 12; // historical
  134.   readonly attribute unsigned short nodeType;
  135.   readonly attribute DOMString nodeName;
  136.  
  137.   readonly attribute DOMString? baseURI;
  138.  
  139.   readonly attribute Document? ownerDocument;
  140.   readonly attribute Node? parentNode;
  141.   readonly attribute Element? parentElement;
  142.   boolean hasChildNodes();
  143.   readonly attribute NodeList childNodes;
  144.   readonly attribute Node? firstChild;
  145.   readonly attribute Node? lastChild;
  146.   readonly attribute Node? previousSibling;
  147.   readonly attribute Node? nextSibling;
  148.  
  149.            attribute DOMString? nodeValue;
  150.            attribute DOMString? textContent;
  151.   Node insertBefore(Node node, Node? child);
  152.   Node appendChild(Node node);
  153.   Node replaceChild(Node node, Node child);
  154.   Node removeChild(Node child);
  155.   void normalize();
  156.  
  157.  
  158. Node cloneNode(optional boolean deep = true);
  159.   boolean isEqualNode(Node? node);
  160.  
  161.   const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
  162.   const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
  163.   const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
  164.   const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
  165.   const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
  166.   const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical
  167.   unsigned short compareDocumentPosition(Node other);
  168.   boolean contains(Node? other);
  169.  
  170.   DOMString? lookupPrefix(DOMString? namespace);
  171.   DOMString? lookupNamespaceURI(DOMString? prefix);
  172.   boolean isDefaultNamespace(DOMString? namespace);
  173. };
  174.  
  175. [Constructor]
  176. interface Document : Node {
  177.   readonly attribute DOMImplementation implementation;
  178.   readonly attribute DOMString URL;
  179.   readonly attribute DOMString documentURI;
  180.   readonly attribute DOMString compatMode;
  181.   readonly attribute DOMString characterSet;
  182.   readonly attribute DOMString contentType;
  183.  
  184.   readonly attribute DocumentType? doctype;
  185.   readonly attribute Element? documentElement;
  186.   HTMLCollection getElementsByTagName(DOMString localName);
  187.   HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  188.   HTMLCollection getElementsByClassName(DOMString classNames);
  189.   Element? getElementById(DOMString elementId);
  190.  
  191.   Element createElement(DOMString localName);
  192.   Element createElementNS(DOMString? namespace, DOMString qualifiedName);
  193.   DocumentFragment createDocumentFragment();
  194.   Text createTextNode(DOMString data);
  195.   Comment createComment(DOMString data);
  196.   ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
  197.  
  198.   Node importNode(Node node, optional boolean deep = true);
  199.   Node adoptNode(Node node);
  200.  
  201.   Event createEvent(DOMString interface);
  202.  
  203.   Range createRange();
  204.  
  205.   // NodeFilter.SHOW_ALL = 0xFFFFFFFF
  206.   NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
  207.   TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
  208.  
  209.   // NEW
  210.   void prepend((Node or DOMString)... nodes);
  211.   void append((Node or DOMString)... nodes);
  212. };
  213.  
  214. interface XMLDocument : Document {};
  215.  
  216. interface DOMImplementation {
  217.   DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
  218.   XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype);
  219.   Document createHTMLDocument(optional DOMString title);
  220.  
  221.   boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version);
  222. };
  223.  
  224. interface DocumentFragment : Node {
  225.   // NEW
  226.   void prepend((Node or DOMString)... nodes);
  227.   void append((Node or DOMString)... nodes);
  228. };
  229.  
  230. interface DocumentType : Node {
  231.   readonly attribute DOMString name;
  232.   readonly attribute DOMString publicId;
  233.   readonly attribute DOMString systemId;
  234.  
  235.   // NEW
  236.   void before((Node or DOMString)... nodes);
  237.   void after((Node or DOMString)... nodes);
  238.   void replace((Node or DOMString)... nodes);
  239.   void remove();
  240. };
  241.  
  242. interface Element : Node {
  243.   readonly attribute DOMString? namespaceURI;
  244.   readonly attribute DOMString? prefix;
  245.   readonly attribute DOMString localName;
  246.   readonly attribute DOMString tagName;
  247.  
  248.            attribute DOMString id;
  249.            attribute DOMString className;
  250.   readonly attribute DOMTokenList classList;
  251.  
  252.   readonly attribute Attr[] attributes;
  253.   DOMString? getAttribute(DOMString name);
  254.   DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
  255.   void setAttribute(DOMString name, DOMString value);
  256.   void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
  257.   void removeAttribute(DOMString name);
  258.   void removeAttributeNS(DOMString? namespace, DOMString localName);
  259.   boolean hasAttribute(DOMString name);
  260.   boolean hasAttributeNS(DOMString? namespace, DOMString localName);
  261.  
  262.   HTMLCollection getElementsByTagName(DOMString localName);
  263.   HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  264.   HTMLCollection getElementsByClassName(DOMString classNames);
  265.  
  266.   readonly attribute HTMLCollection children;
  267.   readonly attribute Element? firstElementChild;
  268.   readonly attribute Element? lastElementChild;
  269.   readonly attribute Element? previousElementSibling;
  270.   readonly attribute Element? nextElementSibling;
  271.   readonly attribute unsigned long childElementCount;
  272.  
  273.  
  274.   // NEW
  275.   void prepend((Node or DOMString)... nodes);
  276.   void append((Node or DOMString)... nodes);
  277.   void before((Node or DOMString)... nodes);
  278.   void after((Node or DOMString)... nodes);
  279.   void replace((Node or DOMString)... nodes);
  280.   void remove();
  281. };
  282.  
  283. interface Attr {
  284.   readonly attribute DOMString name;
  285.            attribute DOMString value;
  286.  
  287.   readonly attribute DOMString? namespaceURI;
  288.   readonly attribute DOMString? prefix;
  289.   readonly attribute DOMString localName;
  290. };
  291.  
  292. interface CharacterData : Node {
  293.   [TreatNullAs=EmptyString] attribute DOMString data;
  294.   readonly attribute unsigned long length;
  295.   DOMString substringData(unsigned long offset, unsigned long count);
  296.   void appendData(DOMString data);
  297.   void insertData(unsigned long offset, DOMString data);
  298.   void deleteData(unsigned long offset, unsigned long count);
  299.   void replaceData(unsigned long offset, unsigned long count, DOMString data);
  300.  
  301.   // NEW
  302.   void before((Node or DOMString)... nodes);
  303.   void after((Node or DOMString)... nodes);
  304.   void replace((Node or DOMString)... nodes);
  305.   void remove();
  306. };
  307.  
  308. interface Text : CharacterData {
  309.   Text splitText(unsigned long offset);
  310.   readonly attribute DOMString wholeText;
  311. };
  312.  
  313. interface ProcessingInstruction : CharacterData {
  314.   readonly attribute DOMString target;
  315. };
  316.  
  317. interface Comment : CharacterData {
  318. };
  319.  
  320. interface Range {
  321.   readonly attribute Node startContainer;
  322.   readonly attribute unsigned long startOffset;
  323.   readonly attribute Node endContainer;
  324.   readonly attribute unsigned long endOffset;
  325.   readonly attribute boolean collapsed;
  326.   readonly attribute Node commonAncestorContainer;
  327.  
  328.   void setStart(Node refNode, unsigned long offset);
  329.   void setEnd(Node refNode, unsigned long offset);
  330.   void setStartBefore(Node refNode);
  331.   void setStartAfter(Node refNode);
  332.   void setEndBefore(Node refNode);
  333.   void setEndAfter(Node refNode);
  334.   void collapse(boolean toStart);
  335.   void selectNode(Node refNode);
  336.   void selectNodeContents(Node refNode);
  337.  
  338.   const unsigned short START_TO_START = 0;
  339.   const unsigned short START_TO_END = 1;
  340.   const unsigned short END_TO_END = 2;
  341.   const unsigned short END_TO_START = 3;
  342.   short compareBoundaryPoints(unsigned short how, Range sourceRange);
  343.  
  344.   void deleteContents();
  345.   DocumentFragment extractContents();
  346.   DocumentFragment cloneContents();
  347.   void insertNode(Node node);
  348.   void surroundContents(Node newParent);
  349.  
  350.   Range cloneRange();
  351.   void detach();
  352.  
  353.   boolean isPointInRange(Node node, unsigned long offset);
  354.   short comparePoint(Node node, unsigned long offset);
  355.  
  356.   boolean intersectsNode(Node node);
  357.  
  358.   stringifier;
  359. };
  360.  
  361. interface NodeIterator {
  362.   readonly attribute Node root;
  363.   readonly attribute Node? referenceNode;
  364.   readonly attribute boolean pointerBeforeReferenceNode;
  365.   readonly attribute unsigned long whatToShow;
  366.   readonly attribute NodeFilter? filter;
  367.  
  368.   Node? nextNode();
  369.   Node? previousNode();
  370.  
  371.   void detach();
  372. };
  373.  
  374. interface TreeWalker {
  375.   readonly attribute Node root;
  376.   readonly attribute unsigned long whatToShow;
  377.   readonly attribute NodeFilter? filter;
  378.  
  379.            attribute Node currentNode;
  380.  
  381.   Node? parentNode();
  382.   Node? firstChild();
  383.   Node? lastChild();
  384.   Node? previousSibling();
  385.   Node? nextSibling();
  386.   Node? previousNode();
  387.   Node? nextNode();
  388. };
  389.  
  390. callback interface NodeFilter {
  391.   // Constants for acceptNode()
  392.   const unsigned short FILTER_ACCEPT = 1;
  393.   const unsigned short FILTER_REJECT = 2;
  394.   const unsigned short FILTER_SKIP = 3;
  395.  
  396.   // Constants for whatToShow
  397.   const unsigned long SHOW_ALL = 0xFFFFFFFF;
  398.   const unsigned long SHOW_ELEMENT = 0x1;
  399.   const unsigned long SHOW_ATTRIBUTE = 0x2; // historical
  400.   const unsigned long SHOW_TEXT = 0x4;
  401.   const unsigned long SHOW_CDATA_SECTION = 0x8; // historical
  402.   const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical
  403.   const unsigned long SHOW_ENTITY = 0x20; // historical
  404.   const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40;
  405.   const unsigned long SHOW_COMMENT = 0x80;
  406.   const unsigned long SHOW_DOCUMENT = 0x100;
  407.   const unsigned long SHOW_DOCUMENT_TYPE = 0x200;
  408.   const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400;
  409.   const unsigned long SHOW_NOTATION = 0x800; // historical
  410.  
  411.   unsigned short acceptNode(Node node);
  412. };
  413.  
  414. [ArrayClass]
  415. interface NodeList {
  416.   getter Node? item(unsigned long index);
  417.   readonly attribute unsigned long length;
  418. };
  419.  
  420. interface HTMLCollection {
  421.   readonly attribute unsigned long length;
  422.   getter Element? item(unsigned long index);
  423.   getter object? namedItem(DOMString name); // only returns Element
  424. };
  425.  
  426. [NoInterfaceObject]
  427. interface DOMStringList {
  428.   readonly attribute unsigned long length;
  429.   getter DOMString? item(unsigned long index);
  430.   boolean contains(DOMString string);
  431. };
  432.  
  433. interface DOMTokenList {
  434.   readonly attribute unsigned long length;
  435.   getter DOMString? item(unsigned long index);
  436.   boolean contains(DOMString token);
  437.   void add(DOMString... tokens);
  438.   void remove(DOMString... tokens);
  439.   boolean toggle(DOMString token, optional boolean force);
  440.   stringifier;
  441. };
  442.  
  443. interface DOMSettableTokenList : DOMTokenList {
  444.             attribute DOMString value;
  445. };
  446.  
  447.