| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

DOMManager

Page history last edited by PBworks 17 years, 8 months ago


 

DOMManager

(extends Object)


Object Summary

Manipulates and returns various DOM properties.


Constructor

This object does not have a constructor. It is statically accessed.


Methods

 

DOMManager.getOffset(elm)

 

parameters

elm - The element to check the offset.

 

returns

The (x,y) coordinates of the element from the top-left corner of the ViewPort.

 

comments

The method will be useful for collision detection algorithms, since it gives coordinates according to a global point of reference.


DOMManager.isChild(elmTestNode,elmParentNode)

 

parameters

elmTestNode - The node to test.

elmParentNode - The parent node to test.

 

returns

true if elmParentNode is a direct parent of elmTestNode.

 

comments

Test whether second node is a direct parent of the first node.


DOMManager.sweep(obj)

 

parameters

obj - The topmost node to begin sweep operation.

 

comments

Removes all empty text nodes (i.e. sweeps) of obj and any children of it recursively. If obj is not given, entire document tree is swept.


DOMManager.getElementsByClassName(strClassName,elmParentNode)

 

parameters

strClassName - the className to scan.

elmParentNode - (optional) The node to start scanning.

 

returns

An array of object references whose className match strClassName.

 

comments

Works similar to document.getElementsByTagName.


DOMManager.removeNode(elm)

 

parameters

elm - The element to remove from the node tree.

 

comments

Removes elm from the DOM tree.


DOMManager.registerExteralLink()

 

comments

Makes links with a class name 'newwin' open in a new window.


DOMManager.unregisterExteralLink()

 

comments

Removes the click event handler from the external links.


DOMManager.quickLoad(fnDelegate,arID)

 

parameters

fnRef - The function reference to call when DOM content is ready.

arID - An array of ID's or DHTML object references that fnDelegate uses directly or indirectly.

 

comments

Executes fnDelegate whenever DOM content is ready. If the page is loaded with external objects and images, this will be much faster than the traditional "window.onload" approach. Just one caveat though, you have to pass any DOM objects that are used while quickloading in arID. For instance if you set the innerHTML of a paragraph with ID "mainContent", and the margin of a div with id "sideContent" in a function called init, then you should call

 

DOMManager.quickLoad(init,["mainContent","sideContent"]);

 

to reassure that these two elements (mainContent and sideContent) are ready when init is called through quickLoad.


See Also

 

None given.


Usage Examples

Comments (0)

You don't have permission to comment on this page.