Using the Document Object Model Extensions
The extensions currently provide additions to
DOMRGBColor. An additional
DOMHTMLEmbedElement, provides an Objective-C DOM class for HTML
Among the useful features of the extensions are the inner/outer HTML and text accessor methods. Given an element block of HTML (a
DOMHTMLElement), you can dynamically get and set the HTML and text from that block using these methods:
innerText gets the inner content of the block without its HTML tags;
innerHTML gets the inner content of the block (with its HTML tags, but not its enclosing tags);
outerHTML gets the entire content of the block. For example, given this HTML block:
innerHTML method will return (as an
innerText method will return (as an
outerHTML method will return (as an
Each of those methods has a corresponding set method (
setOuterHTML) and can be used on any element cast as a
DOMHTMLElement or any subclass of it.
The addition to the
DOMRGBColor interface is also very useful, as it allows you to use the DOM to access the CSS Level 3 alpha channel of an RGB(A) color, even though the DOM Level 2 specification does not include it.
For a complete list of extensions provided by the Objective-C DOM API, see the
DOMExtensions.h header file.