Hi Ian and everyone, here is some more material to update the DOM reference.
Bug fixes and typos: ************************ 1) http://mozilla.org/docs/dom/domref/dom_frame_ref2.html#998120 * "Its interface-the two optional properties cols and rows-are a way to indicate the dimenions of the frame set, how many subframes it manages." "dimenions" should be "dimensions" * In the example, I suggest adding a id="frame1" attribute to the first frame of the HTML snippet, so that the javascript snippet matches the HTML code. If you that's done nowhere else (matching the js to the html), then nevermind. * In the same example, the comment should be changed: "// do something with each frame as frame[i]" "frame[i]" should read "frames[i]" 2) http://mozilla.org/docs/dom/domref/dom_doc_ref.html#1022427 (Document) * "IT is contained by the window object (see DOM window Reference) and may contain any number of elements (see DOM Element Reference.)" "IT" should read "It" * We should add a note somewhere that the properties and methods described in that page are only available to xhtml and html documents (as defined by the DOM Level 2 HTML spec). XML documents have a different document object (XMLDocument), and XUL documents have yet another different document object(XULDocument). Each has different properties, though the common properties (Document) are described in the DOM Level 2 Core spec. 3) http://mozilla.org/docs/dom/domref/dom_doc_ref5.html#1003433 Parameters: "appletes" should read "applets" New properties and methods: ***************************** 1) http://mozilla.org/docs/dom/domref/dom_frame_ref5.html#998130 (FRAME) A missing property, and a new one: * name: The frame name (object of the target attribute). * contentWindow: returns the window object for this frame [readonly][non standard] Detailed description: Syntax: frameWindow = frameElement.contentWindow Parameters: frameWindow is the window object for this frame Example: f = document.getElementById("frame"); f.contentWindow.location = "http://mozilla.org"; f.contentWindow.history.back(); Notes: The same functionality can be achieved by giving the frame a name (e.g. myFrame) then using window.frames["myFrame"]. Specification: None. 2) The same thing as 1) applies to http://mozilla.org/docs/dom/domref/dom_frame_ref14.html#998139 (IFRAME) 3) http://mozilla.org/docs/dom/domref/dom_doc_ref.html#1022427 (HTMLDocument) Missing or incomplete properties: * title: The title of this document. Detailed description: Syntax: docTitle = document.title Parameters: docTitle is a string containing the title of the document Example: document.title = "A new title for this document" Notes: Same as window.title, though window.title will probably be deprecated some day. Specification: DOM Level 1 HTML (http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html#ID-18446827) * domain: Even though the W3C spec says it's readonly, in Mozilla it is settable. This should reflected in the syntax of the property. * URL: Example missing: var currentURL = document.URL; alert(currentURL); The Note is wrong: "URL is a somewhat more appropriately named replacement for the DOM Level 0 document.location property also described here. Like document.location, document.URL is not settable because a document can have only one URL." should read "URL is a replacement for the DOM Level 0 document.location.href property. However document.URL is not settable, unlike document.location.href." because document.location is just a hack that maps to document.location.href, and it is not readonly, it's definitely settable in all browsers. * body: returns the BODY element, or the FRAMESET element in a frameset. Detailed description: The element that contains the content for the document. In documents with BODY contents, returns the BODY element, and in frameset documents, this returns the outermost FRAMESET element Syntax: bodyElement = document.body document.body = aNewBodyElement Parameters: bodyElement is the BODY or FRAMESET element of the current document aNewBodyElement is a BODY or FRAMESET element that will replace the current BODY or FRAMESET element. Example: HTML: <body id="oldBodyElement"></body> JavaScript: alert(document.body.id); // "oldBodyElement" var aNewBodyElement = document.createElement("body"); aNewBodyElement.id = "newBodyElement"; document.body = aNewBodyElement; alert(document.body.id); // "newBodyElement" Notes: Setting a new body element will effectively remove all the current children of your old body element, since it does a simple replaceChild(). * links: Example: var links = document.links; for(var i = 0; i < links.length; i++) { var linkHref = document.createTextNode(links[i].href); var lineBreak = document.createElement("br"); document.body.appendChild(linkHref); document.body.appendChild(lineBreak); } * anchors: Notes: For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute. Personal note: I love your example for this one ;-) * open(): Notes: an automatic document.open() is executed if document.write() is called after the page has loaded * write() and writeln(): The Notes are erroneous. They should read: Writing to a document that has already loaded without calling document.open() will automatically perform a document.open() call. Once you have finished writing, it is recommended to call document.close(), to tell the browser to finish loading the page. The text you write is parsed into the document's structure model. In the example above, the H1 element becomes a node in the document. If the document.write() call is embedded directly in the HTML code, then it will not call document.open(). For example: <div><script type="text/javascript">document.write("<h1>Main title</h1>")</script></div> Personal Note: Ian, where did you read the comments that are currently displayed as "Notes" for document.write() and document.writeln()? It's like, exactly the opposite of what it really does, unless I am badly mistaken and need a serious beating. * getElementsByTagName(): The example should read "tables.length" instead of "length(tables)". Also the for loop should read "tables.length" instead of "frames.length". Finally, the dump statement should read "dump(tables[i].align)" instead of "dump(table[i].alignment)". New property to the HTMLDocument object: * compatMode: Whether the document is rendered in quirks mode or strict mode. Detailed description: Syntax: renderMode = document.compatMode Parameters: renderMode is a string containing "BackCompat" if the document is rendered in Quirks mode, or "CSS1Compat" if the document is rendered in Strict mode. Notes: None. Specification: None. That's it for the moment, I'll come up with more later on. Thanks in advance and keep up the excellent work!! -Fabian.
