What's new? | Help | Directory | Sign in
Google
             
Search
for
Updated Nov 15, 2008 by pilgrim
Labels: is-article, about-dom
ArticleDomHelper  
Introducing DOMHelper

Español日本語Français
HomeArticles DOM

TODO intro

The code

/**
 * This is used when calling methods that depend on a document_ instance
 * @private
 * @return {goog.dom.DomHelper}
 */
goog.dom.getDefaultDomHelper_ = function() {
  if (!goog.dom.defaultDomHelper_) {
    goog.dom.defaultDomHelper_ = new goog.dom.DomHelper;
  }
  return goog.dom.defaultDomHelper_;
};


/**
 * Gets the dom helper object for the document where the element resides.
 * @param {Element} opt_element If present, gets the DomHelper for this element.
 * @return {goog.dom.DomHelper} The DomHelper.
 */
goog.dom.getDomHelper = function(opt_element) {
  return opt_element ?
      new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) :
      goog.dom.getDefaultDomHelper_();
};


/**
 * Create an instance of a DOM helper with a new document object
 * @param {Document} opt_document Document object to associate with this DOM helper
 * @constructor
 */
goog.dom.DomHelper = function(opt_document) {
  /**
   * Reference to the document object to use
   * @type Document
   */
  this.document_ = opt_document || window.document || document;
};

/**
 * Set the document object
 * @param {Document} document Document object
 */
goog.dom.DomHelper.prototype.setDocument = function(document) {
  this.document_ = document;
};


/**
 * Get the document object being used by the dom library
 * @return {Document} Document object
 */
goog.dom.DomHelper.prototype.getDocument = function() {
  return this.document_;
};

The code walkthrough

TODO walkthrough

Further reading

TODO further reading


Comment by ruben.llibre, May 15, 2008

this isn't much of a intro?

Comment by caseymwise, May 16, 2008

This is JavaScript?? Um, what does it do, what should we expect, how do we implement, etc? I'm missing something here.

Comment by Alon.Fluman, May 16, 2008

How can we use the DomHelper? is there any js file we need to download?is so where from?

Comment by fantasybei, May 16, 2008

it's complete?it seems as if it's a segment?

Comment by HiroyukiNakatsuka, May 26, 2008

Is any request of DOM helper? Is any request of original Object-object classified wrapper like Java packages for DOM?

I think none, so sorry...

Comment by fredrik.carlbom, Jun 07, 2008

This is just an introduction to the helper, all files can be browsed in your browser: http://code.google.com/p/doctype/source/browse


Sign in to add a comment