|
ArticleDomHelper
Introducing DOMHelper
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 walkthroughTODO walkthrough Further readingTODO further reading |
Sign in to add a comment
this isn't much of a intro?
This is JavaScript?? Um, what does it do, what should we expect, how do we implement, etc? I'm missing something here.
How can we use the DomHelper? is there any js file we need to download?is so where from?
it's complete?it seems as if it's a segment?
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...
This is just an introduction to the helper, all files can be browsed in your browser: http://code.google.com/p/doctype/source/browse