1、SMPTE 366M-2002 SMPTE STANDARD for Television - Declarative Data Essence - Document Object Model Level O (DOM-O) and Related Object Environment 1 Scope This standard defines a document object model (DOM) and an object environment for use in manipu- lating HTML documents using the ECMAScnpt envi- ron
2、ment of declarative data essence. The standard reflects the best current practice for continuing use in television and other applications. 2 Reference and organization 2.1 Normative reference The following standard contains provisions which, through reference in this text, constitute provisions of t
3、his standard. At the time of publication, the edition indicated was valid. All standards are subject to revision, and parties to agreements based on this standard are encouraged to investigate the possibility of applying the most recent edition of the standard indicated below. ISOAEC 16262:1998, Inf
4、ormation Technology - ECMAScnpt Language Specification 2.2 Document organization 1 Scope 2 Reference and organization 3 Introduction 4 Definition (with IDL) 5 Event handling 6 Exception handling 7 Security 8 Standard color names 9 ECMAScnpt language binding Annex A Object relationships Annex B Bibli
5、ography Page 1 of 15 pages 3 Introduction This is a definition for a document object model and object environment (DOM-O), to allow orderly transition from existing current authoring practice to DOM-1 and DOM-2. DOM-O is in widespread use today in the form of the objects and methods imple- mented by
6、 the popular browser vendors. This is an attempt to document something like DOM4 (as was loosely defined by W3C). It provides an authoring standard to those who wish to make content that will be compatible with the largest number of down level browsers, such as those used in interactive television r
7、eceivers supporting the declarative data essence content level 1 specification. Standardized support for a DOM-O is therefore re- quired if one expects the existing tools, content, and author knowledge-base to be usable in the short term. And, DOM-O support in browsers will continue to live on well
8、beyond deployment of DOM-2, in order to avoid reauthoring of everything on the web. 4 Definition (with IDL) This standard is intended to define the intersection of Microsoft Internet Explorer, version 3.0 (IE3) and Netscape Navigator, version 3.0 (“3) relative to their DOM. Additionally, there are s
9、ome important features of both IE3 and “3 that are not in ECMAScript, but not strictly part of the DOM either. These must also be addressed. So DOM-O is a baseline DOM, as well as a set of miscellaneous functions including an exten- sion to the ECMAScript String object, and the addition of some navi
10、gation objects. Collectively, this is referred to as DOM-O. CopyngM020m byTHESOCiEPIOF MOTION PICTURE AND TELEVISION ENGINEERS 5.95 W. Haitsdale Ave., white Plais, NY 10607 (914) 761-1100 Approved January 3,2002 SMPTE 366M-2002 The definition is broken into three main groups: 4.1 Anchor - DOM - ECMA
11、Script Extensions - Navigation Interface Anchor attribute String name; I; The DOM is the part that maps to a strict definition of a document object model (and is in theory easily mappable onto DOM-1). The ECMAScript Extensions are objects or methods that extend the definition of standard ECMAScript
12、objects to handle current prac- tice. Navigation is a set of objects that handle some of the common functions that have come to be ex- pected in a given implementation of the client. These latter two categories are not DOM, but supporting objects that have become common for authors to use. An HTML a
13、nchor tag object. Properties - Name - The HTML NAME attribute Methods - None 4.2 The strict DOM consists of the following objects: - Anchor - Button - Checkbox - Document - Hidden - Image - Link - Form Interface Button readonly attribute Form form; readonly attribute String name; readonly attribute
14、String type; attribute String value; void blur( ); void click( ); 1; An HTML form button object. - Location - Option Event handlers - Password - onBlur - Radio - onclick - Reset - onfocus - Select - Submit Properties - Text - TextArea - Value - The string on the face of the button Methods The ECMASc
15、npt object extension is an extension of - blur( ) the standard ECMAScript: - Click() - String The new Navigation objects are: - Histoty - Navigator - Window These are all defined as a flat object space. There is no inheritance or hierarchy and all methods are fully defined in each object definition.
16、 The IDL for each object follows: 4.3 Checkbox Interface Checkbox attribute boolean checked; readonly attribute boolean defauitchecked; readonly attribute Form form; readonly attribute String name; readonly attribute String type; attribute String value; void blur( ); void click( ); void focus( ); I;
17、 Page 2 of 15 pages SMPTE 366M-2002 This is the HTML form checkbox object. Event handlers - onBlur - onclick - onfocus Properties - Checked - Boolean sta e of the checkbox (true if - defaultchecked - The HTML CHECKED attribute - Form - The Form containing this element - Name - The HTML NAME attribut
18、e - Type - The type of this form element - Value - The HTML TYPE attribute currently checked, else false) Methods - blur( ) - Click() - focus() 4.4 Document Interface Anchorsequence 1; Interface FormSequence 1; Interface IrnageSequence Anchor item (in unsigned long index); readonly attribute unsigne
19、d long length; Form item (in unsigned long index); readonly attribute unsigned long length; Image item (in unsigned long index); readonly attribute unsigned long length; 1; Interface Linksequence 1; Interface Document Link item (in unsigned long index); readonly attribute unsigned long length; attri
20、bute String alinkcolor; readonly attribute Anchorsequence anchors; attribute String bgColor; attribute String cookie; attribute String fgColor; readonly attribute Formsequence forms; readonly attribute IrnageSequence images; attribute String IastModified; attribute String linkcolor; readonly attribu
21、te LinkSequence links; readonly attribute String location; readonly attribute String referrer; readonly attribute String title; readonly attribute String URL; attribute String vlinkColor; void clear( ); void close( ); void open (in String mimeType); void write (in String exprl, in String expr2, .);
22、void writeln (in String exprl, in String expr2, .); 1; The document object. Properties - alinkColor -The HTMLALINK attribute. Note that the leading number is optional for all numeric values, and the Standard Color Names are supported. - Anchors -An array of anchor objects in the order the anchor tag
23、s appear in the HTML document. Use anchodength to get the number of anchors in a document. - bgcolor - The HTML BGCOLOR attribute. Note that the leading number is optional for all numeric values, and the Standard Color Names are supported. - Cookie - All the cookie strings sent in the HTTP reply hea
24、ders cumntty saved and concatenated. The syntax for each one is name=value; expires=expDate; the expDate format is: “Wdy, DD-Mmm-W HH:MM:SS GMT“. - fgcolor - The HTML FGCOLOR attribute. Note that the leading number is optional for all numericvalues, and the Standard Color Names are supported. - Form
25、s - An array of form objects in the order the forms appear in the HTML file. Use forms.length to get the number of forms in a document. Note that only the formal array form is permitted (.e., forrnsindex ). - Images - An array of image objects in the order they appear in the HTML document. Use image
26、s.length to get the number of images in a document. - iasthnodified - The value of the HJTP reply header field of the same name. Date formats are as permitted by HTTPA . 1 . - linkColor - The HTML LINK attribute. Note that the leading number is optional for all numeric values, and the Standard Color
27、 Names are supported. - Links - An array of link objects in the order the hypertext links appear in the HTML document. Use links.length to get the number of links in a document. Page 3 of 15 pages SMPTE 366M-2002 - Location - A deprecated synonym for the URL property. This property exists only for c
28、ompati- bility with Javascript 1 .O. - Referrer - String that contains the URL of the document that this was linked from. - Tile - The HTML TITLE tag. - URL- A read-only string reflecting the actual URL of this document. Note that document.URL may differ from window.location because the actual URLof
29、 the document may be different from the URL used to request the document. Docu- ment.URL is not reflected in the windows location object. - vlinkcolor - The HTML VLINK attribute. Note that the leading number is optional for all numeric values, and the Standard Color Names are supported. Methods - Cl
30、ear( ) - Clear the contents of this document. - Close( ) - Close a previously opened new docu- ment and display it. - Open( ) - Open a new document for creation. - mimeType -the COrRentType of the document. - Write( ) - Output one or more expressions to the currently open document. - Exprn - Any ECM
31、AScript expression that results in a string. - writein( ) - Same as write( ) except a new line is inserted at the end of all the expressions. - Exprn - Any ECMAScript expression that results in a string. 4.5 Form Interface ObjectSequence Object item (in unsigned long index); readonly attribute unsig
32、ned long length; 1; Interface Form attribute String action; readonly attribute ObjectSequence elements; attribute String encoding; readonly attribute long length; attribute String method; attribute String name; attribute String target; void submit ( ); 1; The HTML Form object. Event Handlers - onsub
33、mit Properties - Action - The HTML ACTION attribute. - Elementst -An array of objects for each form element in the order in which they appear in the form. - Encoding - The string value of the MIME encoding as specified in ENCTYPE attribute. - Length - Number of elements in elements above. - Method -
34、 The HTML METHOD attribute. - Name - The name of the form. - Target - The HTMLTARGET attribute. Methods - Submit( ) - Cause the form to be submitted. 4.6 Hidden Interface Hidden readonly attribute Form form; readonly attribute String name; readonly attribute String type; attribute String value; 1; T
35、he HTML Form Hidden field object. Properties - Form - The Form containing this element - Name - The name of this form element - Type - The type of this form element - Value - The element value. Methods - 4.7 History Interface History void back( ); void forward( ); void go (in long delta); void go (i
36、n String location); 1; This provides a global history list and management. Note that it is a property of the Window Object, and not per frame. Document URLs are added to the history whenever a link is taken by the user. Whenever one navigates backand then a peer branch is taken, the Page 4 of 15 pag
37、es SMPTE 366NI-2002 other peer tree (if any) of document URLs is pruned from the history. Navigating back causes the docu- ment that the user navigated from to reach the current document to be displayed. Navigating forwardcauses the document most recently reached from the current document to be disp
38、layed. The history list includes the navigation from triggers just like they were links that the user had taken. When matching with go(), the location argument is matched against URLs in the history list and a partial match occurs when the full string content of location matches the initial set of c
39、haracters in oneof the URLs (.e., the match is anchored to the beginning of the URL). This is started at the current position in the forward direction, wrapping around to the top. Properties - , Methods - Back( ) - Load the previous URLin the history list. - Forward( ) - Load the next URL in the his
40、tory list. - Go( ) - Load a specific URL in the history list. - Delta - An integer number of an item in the history list relative to the current docu- ment. A positive number indicates the equivalent of delta forward( ) calls. A negative number indicates the equivalent of deha back( ) calls. - Locat
41、ion -A URLof an item in the history list. Partial matches are permitted where the first partial string match is loaded. 4.8 Image Interface Image attribute long border; readonly attribute boolean complete; attribute long height; attribute long hspace; attribute String lowsrc; attribute String name;
42、attribute String src; attribute long vspace; attribute long width; 1; The image object reflects an image included in an HTML document. Event handlers - onload Properties - Border - An integer value reflecting the width of the images border in pixels. - Complete - A boolean value indicating whether t
43、he image has finished loading. - Height - An integer value reflecting the height of an image in pixels. - hspace - An integer value reflecting the HSPACE attribute of the CIMG tag, which controls the amount of white space, in pixels, to the left and right of the image. - lowsrc - A string value cont
44、aining the URL of the low-resolution version of the image to load. - Name - A string value indicating the name of the image object. - src - A string value indicating the URL of the image. - vspace - An integer value reflecting the VSPACE attribute of the CIMG tag, which controls the amount of white
45、space, in pixels, above and below the image. - Width - An integer value indicating the width of an image in pixels. 4.9 Link Interface Link attribute String hash; attribute String host; attribute String hostname; attribute String href; attribute String pathname; attribute String port; attribute Stri
46、ng protocol; attribute String search; attribute String target; 1; The HTML Link object of the form: protocoldhost :pott/pathname?search#hash Event handlers - onclick - onMouseout - onMousever Properties - Hash - The URLfragment component. - Host -The URL domain name (or IP address) part of the autho
47、r component. - hostname - The entire authority component, including port number, if present. - href - The entire URL. - pathname - The URL path component. SMPTE 366M-2002 - Port - The port number of the URL authority - Protocol - The scheme name, including the “:“. - Search - The URL query component
48、. - Target - The HTML TARGET attribute. component; zero if none. Methods - 4.10 Location Interface Location attribute String hash; attribute String host; attribute String hostname; attribute String href; attribute String pathname; attribute String port; attribute String protocol; attribute String se
49、arch; 1; The location object of a window is a reference to Location object, which is a representation of the URL of the document currently being displayed in that window. Location represents the URL used to request the current document, but may not equal the actual URL of the document, which is stored in the string document.URL. In addition to its properties, the Loca- tion object can be used as if it were itself a primitive string value. If the value of a Location object is read, the string obtained is the same as that obtained if the href