WD-DOM-Level-2-19990304


Appendix C: IDL Definitions

This appendix contains the complete OMG IDL for the Level 1 Document Object Model definitions. The definitions are divided into Stylesheets , CSS , Events , Filters and Iterators , and Range .

C.1: Document Object Model Level 2 Stylesheets

stylesheets.idl:

// File: stylesheets.idl
#ifndef _STYLESHEETS_IDL_
#define _STYLESHEETS_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module stylesheets
{
  typedef dom::DOMString DOMString;
  typedef dom::Node Node;

  interface StyleSheet {
    readonly attribute  DOMString            type;
             attribute  boolean              disabled;
    readonly attribute  Node                 owningNode;
    readonly attribute  StyleSheet           parentStyleSheet;
    readonly attribute  DOMString            href;
    readonly attribute  DOMString            title;
    readonly attribute  DOMString            media;
  };

  interface StyleSheetCollection {
    readonly attribute  unsigned long        length;
    StyleSheet                item(in unsigned long index);
  };

};

#endif // _STYLESHEETS_IDL_


C.2: Document Object Model Level 2 CSS

css.idl:

// File: css.idl
#ifndef _CSS_IDL_
#define _CSS_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module css
{
  typedef dom::DOMString DOMString;
  typedef dom::StyleSheet StyleSheet;

  interface CSSRule;
  interface CSSStyleSheet;
  interface CSSStyleDeclaration;

  interface CSSRuleCollection {
    readonly attribute  unsigned long        length;
    CSSRule                   item(in unsigned long index);
  };

  interface CSSRule {
    // RuleType
    const unsigned short      UNKNOWN_RULE       = 0;
    const unsigned short      STYLE_RULE         = 1;
    const unsigned short      IMPORT_RULE        = 2;
    const unsigned short      MEDIA_RULE         = 3;
    const unsigned short      FONT_FACE_RULE     = 4;
    const unsigned short      PAGE_RULE          = 5;

    readonly attribute  unsigned short       type;
             attribute  DOMString            cssText;
                                   // raises(DOMException) on setting
    readonly attribute  CSSStyleSheet        parentStyleSheet;
    readonly attribute  CSSRule              parentRule;
  };

  interface CSSStyleRule : CSSRule {
             attribute  DOMString            selectorText;
    readonly attribute  CSSStyleDeclaration  style;
  };

  interface CSSMediaRule : CSSRule {
             attribute  DOMString            mediaTypes;
    readonly attribute  CSSRuleCollection    cssRules;
    unsigned long             insertRule(in DOMString rule, 
                                         in unsigned long index)
                                         raises(DOMException);
    void                      deleteRule(in unsigned long index);
  };

  interface CSSFontFaceRule : CSSRule {
    readonly attribute  CSSStyleDeclaration  style;
  };

  interface CSSPageRule : CSSRule {
             attribute  DOMString            selectorText;
    readonly attribute  CSSStyleDeclaration  style;
  };

  interface CSSImportRule : CSSRule {
             attribute  DOMString            href;
             attribute  DOMString            media;
    readonly attribute  CSSStyleSheet        styleSheet;
  };

  interface CSSUnknownRule : CSSRule {
  };

  interface CSSStyleDeclaration {
             attribute  DOMString            cssText;
                                         // raises(DOMException) on setting
    DOMString                 getPropertyValue(in DOMString propertyName);
    DOMString                 removeProperty(in DOMString propertyName);
    DOMString                 getPropertyPriority(in DOMString propertyName);
    void                      setProperty(in DOMString propertyName, 
                                          in DOMString value, 
                                          in DOMString priority)
                                          raises(DOMException);
    readonly attribute  unsigned long        length;
    DOMString                 item(in unsigned long index);
    readonly attribute  CSSRule              parentRule;
  };

  interface CSS2Properties {
             attribute  DOMString            azimuth;
             attribute  DOMString            background;
             attribute  DOMString            backgroundAttachment;
             attribute  DOMString            backgroundColor;
             attribute  DOMString            backgroundImage;
             attribute  DOMString            backgroundPosition;
             attribute  DOMString            backgroundRepeat;
             attribute  DOMString            border;
             attribute  DOMString            borderCollapse;
             attribute  DOMString            borderColor;
             attribute  DOMString            borderSpacing;
             attribute  DOMString            borderStyle;
             attribute  DOMString            borderTop;
             attribute  DOMString            borderRight;
             attribute  DOMString            borderBottom;
             attribute  DOMString            borderLeft;
             attribute  DOMString            borderTopColor;
             attribute  DOMString            borderRightColor;
             attribute  DOMString            borderBottomColor;
             attribute  DOMString            borderLeftColor;
             attribute  DOMString            borderTopStyle;
             attribute  DOMString            borderRightStyle;
             attribute  DOMString            borderBottomStyle;
             attribute  DOMString            borderLeftStyle;
             attribute  DOMString            borderTopWidth;
             attribute  DOMString            borderRightWidth;
             attribute  DOMString            borderBottomWidth;
             attribute  DOMString            borderLeftWidth;
             attribute  DOMString            borderWidth;
             attribute  DOMString            bottom;
             attribute  DOMString            captionSide;
             attribute  DOMString            clear;
             attribute  DOMString            clip;
             attribute  DOMString            color;
             attribute  DOMString            content;
             attribute  DOMString            counterIncrement;
             attribute  DOMString            counterReset;
             attribute  DOMString            cue;
             attribute  DOMString            cueAfter;
             attribute  DOMString            cueBefore;
             attribute  DOMString            cursor;
             attribute  DOMString            direction;
             attribute  DOMString            display;
             attribute  DOMString            elevation;
             attribute  DOMString            emptyCells;
             attribute  DOMString            cssFloat;
             attribute  DOMString            font;
             attribute  DOMString            fontFamily;
             attribute  DOMString            fontSize;
             attribute  DOMString            fontSizeAdjust;
             attribute  DOMString            fontStretch;
             attribute  DOMString            fontStyle;
             attribute  DOMString            fontVariant;
             attribute  DOMString            fontWeight;
             attribute  DOMString            height;
             attribute  DOMString            left;
             attribute  DOMString            letterSpacing;
             attribute  DOMString            lineHeight;
             attribute  DOMString            listStyle;
             attribute  DOMString            listStyleImage;
             attribute  DOMString            listStylePosition;
             attribute  DOMString            listStyleType;
             attribute  DOMString            margin;
             attribute  DOMString            marginTop;
             attribute  DOMString            marginRight;
             attribute  DOMString            marginBottom;
             attribute  DOMString            marginLeft;
             attribute  DOMString            markerOffset;
             attribute  DOMString            marks;
             attribute  DOMString            maxHeight;
             attribute  DOMString            maxWidth;
             attribute  DOMString            minHeight;
             attribute  DOMString            minWidth;
             attribute  DOMString            orphans;
             attribute  DOMString            outline;
             attribute  DOMString            outlineColor;
             attribute  DOMString            outlineStyle;
             attribute  DOMString            outlineWidth;
             attribute  DOMString            overflow;
             attribute  DOMString            padding;
             attribute  DOMString            paddingTop;
             attribute  DOMString            paddingRight;
             attribute  DOMString            paddingBottom;
             attribute  DOMString            paddingLeft;
             attribute  DOMString            page;
             attribute  DOMString            pageBreakAfter;
             attribute  DOMString            pageBreakBefore;
             attribute  DOMString            pageBreakInside;
             attribute  DOMString            pause;
             attribute  DOMString            pauseAfter;
             attribute  DOMString            pauseBefore;
             attribute  DOMString            pitch;
             attribute  DOMString            pitchRange;
             attribute  DOMString            playDuring;
             attribute  DOMString            position;
             attribute  DOMString            quotes;
             attribute  DOMString            richness;
             attribute  DOMString            right;
             attribute  DOMString            size;
             attribute  DOMString            speak;
             attribute  DOMString            speakHeader;
             attribute  DOMString            speakNumeral;
             attribute  DOMString            speakPunctuation;
             attribute  DOMString            speechRate;
             attribute  DOMString            stress;
             attribute  DOMString            tableLayout;
             attribute  DOMString            textAlign;
             attribute  DOMString            textDecoration;
             attribute  DOMString            textIndent;
             attribute  DOMString            textShadow;
             attribute  DOMString            textTransform;
             attribute  DOMString            top;
             attribute  DOMString            unicodeBidi;
             attribute  DOMString            verticalAlign;
             attribute  DOMString            visibility;
             attribute  DOMString            voiceFamily;
             attribute  DOMString            volume;
             attribute  DOMString            whiteSpace;
             attribute  DOMString            widows;
             attribute  DOMString            width;
             attribute  DOMString            wordSpacing;
             attribute  DOMString            zIndex;
  };

  interface CSSStyleSheet : StyleSheet {
    readonly attribute  CSSRuleCollection    cssRules;
    unsigned long             insertRule(in DOMString rule, 
                                         in unsigned long index)
                                         raises(DOMException);
    void                      deleteRule(in unsigned long index)
                                         raises(DOMException);
  };

};

#endif // _CSS_IDL_


C.3: Document Object Model Level 2 Events

events.idl:

// File: events.idl
#ifndef _EVENTS_IDL_
#define _EVENTS_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module events
{
  typedef dom::DOMString DOMString;
  typedef dom::Node Node;

  interface EventListener;
  interface Event;

  interface EventTarget {
    void                      addEventListener(in DOMString type, 
                                               in boolean postProcess, 
                                               in boolean useCapture, 
                                               in EventListener listener);
    void                      removeEventListener(in DOMString type, 
                                                  in boolean postProcess, 
                                                  in boolean useCapture, 
                                                  in EventListener listener);
  };

  interface EventListener {
    void                      handleEvent(in Event event);
  };

  interface Event {
             attribute  DOMString            type;
             attribute  Node                 target;
             attribute  Node                 currentNode;
             attribute  boolean              cancelBubble;
             attribute  boolean              cancelCapture;
             attribute  boolean              returnValue;
  };

  interface UIEvent : Event {
             attribute  long                 screenX;
             attribute  long                 screenY;
             attribute  long                 clientX;
             attribute  long                 clientY;
             attribute  boolean              altKey;
             attribute  boolean              ctrlKey;
             attribute  boolean              shiftKey;
             attribute  unsigned long        keyCode;
             attribute  unsigned long        charCode;
             attribute  unsigned short       button;
  };

  interface MutationEvent : Event {
             attribute  Node                 relatedNode;
             attribute  DOMString            prevValue;
             attribute  DOMString            newValue;
             attribute  DOMString            attrName;
  };

};

#endif // _EVENTS_IDL_


C.4: Document Object Model Level 2 Filters and Iterators

fi.idl:

// File: fi.idl
#ifndef _FI_IDL_
#define _FI_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module fi
{
  typedef dom::Node Node;

  interface NodeIterator {
    Node                      nextNode();
    Node                      prevNode();
  };

  interface Document {
    boolean                   createTreeIterator(in Node root, 
                                                 in short whatToShow);
  };

  interface NodeFilter {
    boolean                   acceptNode(in Node n);
  };

};

#endif // _FI_IDL_


C.5: Document Object Model Level 2 Range

range.idl:

// File: range.idl
#ifndef _RANGE_IDL_
#define _RANGE_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module range
{
  typedef dom::Node Node;
  typedef dom::DocumentFragment DocumentFragment;
  typedef dom::DOMString DOMString;

  exception RangeException {
    unsigned short   code;
  };

  // RangeExceptionCode
  const unsigned short      BAD_ENDPOINTS_ERR  = 201;
  const unsigned short      INVALID_NODE_TYPE_ERR = 202;
  const unsigned short      NULL_PARENT_ERR    = 203;


  interface Range {
    readonly attribute  Node                 startParent;
    readonly attribute  long                 startOffset;
    readonly attribute  Node                 endParent;
    readonly attribute  long                 endOffset;
    readonly attribute  boolean              isCollapsed;
    readonly attribute  Node                 commonParent;
    void                      setStart(in Node parent, 
                                       in long offset)
                                       raises(RangeException);
    void                      setEnd(in Node parent, 
                                     in long offset)
                                     raises(RangeException);
    void                      setStartBefore(in Node sibling)
                                             raises(RangeException);
    void                      setStartAfter(in Node sibling)
                                            raises(RangeException);
    void                      setEndBefore(in Node sibling)
                                           raises(RangeException);
    void                      setEndAfter(in Node sibling)
                                          raises(RangeException);
    void                      collapse(in boolean toStart);
    void                      selectNode(in Node n)
                                         raises(RangeException);
    void                      selectNodeContents(in Node n)
                                                 raises(RangeException);
    typedef enum CompareHow_ {
      StartToStart,
      StartToEnd,
      EndToEnd,
      EndToStart
    } CompareHow;
    short                     compareEndPoints(in CompareHow how, 
                                               in Range sourceRange)
                                               raises(DOMException);
    void                      deleteContents()
                                             raises(DOMException);
    DocumentFragment          extractContents()
                                              raises(DOMException);
    DocumentFragment          cloneContents();
    void                      insertNode(in Node n)
                                         raises(DOMException, RangeException);
    void                      surroundContents(in Node n)
                                               raises(DOMException, RangeException);
    Range                     cloneRange();
    DOMString                 toString();
  };

};

#endif // _RANGE_IDL_