Functions | Variables

/home/ivan/src/sit/branches/3.x/scripts/dojo/src/dom.js File Reference

Go to the source code of this file.

Functions

dojo provide ("dojo.dom")

Variables

dojo dom ELEMENT_NODE = 1
dojo dom ATTRIBUTE_NODE = 2
dojo dom TEXT_NODE = 3
dojo dom CDATA_SECTION_NODE = 4
dojo dom ENTITY_REFERENCE_NODE = 5
dojo dom ENTITY_NODE = 6
dojo dom PROCESSING_INSTRUCTION_NODE = 7
dojo dom COMMENT_NODE = 8
dojo dom DOCUMENT_NODE = 9
dojo dom DOCUMENT_TYPE_NODE = 10
dojo dom DOCUMENT_FRAGMENT_NODE = 11
dojo dom NOTATION_NODE = 12
dojo dom dojoml = "http://www.dojotoolkit.org/2004/dojoml"
dojo dom xmlns = {svg:"http://www.w3.org/2000/svg", smil:"http://www.w3.org/2001/SMIL20/", mml:"http://www.w3.org/1998/Math/MathML", cml:"http://www.xml-cml.org", xlink:"http://www.w3.org/1999/xlink", xhtml:"http://www.w3.org/1999/xhtml", xul:"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", xbl:"http://www.mozilla.org/xbl", fo:"http://www.w3.org/1999/XSL/Format", xsl:"http://www.w3.org/1999/XSL/Transform", xslt:"http://www.w3.org/1999/XSL/Transform", xi:"http://www.w3.org/2001/XInclude", xforms:"http://www.w3.org/2002/01/xforms", saxon:"http://icl.com/saxon", xalan:"http://xml.apache.org/xslt", xsd:"http://www.w3.org/2001/XMLSchema", dt:"http://www.w3.org/2001/XMLSchema-datatypes", xsi:"http://www.w3.org/2001/XMLSchema-instance", rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#", rdfs:"http://www.w3.org/2000/01/rdf-schema#", dc:"http://purl.org/dc/elements/1.1/", dcq:"http://purl.org/dc/qualifiers/1.0", "soap-env":"http://schemas.xmlsoap.org/soap/envelope/", wsdl:"http://schemas.xmlsoap.org/wsdl/", AdobeExtensions:"http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"}
dojo dom isNode
dojo dom getUniqueId
dojo dom getUniqueId _idIncrement = 0
dojo dom firstElement
dojo dom lastElement
dojo dom nextElement
dojo dom prevElement
dojo dom moveChildren
dojo dom copyChildren
dojo dom replaceChildren
dojo dom removeChildren
dojo dom replaceNode
dojo dom destroyNode
dojo dom removeNode
dojo dom getAncestors
dojo dom getAncestorsByTag
dojo dom getFirstAncestorByTag
dojo dom isDescendantOf
dojo dom innerXML
dojo dom createDocument
dojo dom createDocumentFromText
dojo dom prependChild
dojo dom insertBefore
dojo dom insertAfter
dojo dom insertAtPosition
dojo dom insertAtIndex
dojo dom textContent
dojo dom hasParent
dojo dom isTag
dojo dom setAttributeNS

Function Documentation

dojo provide ( "dojo.dom"   ) 

Variable Documentation

dojo dom getUniqueId _idIncrement = 0

Definition at line 46 of file dom.js.

dojo dom ATTRIBUTE_NODE = 2

Definition at line 15 of file dom.js.

dojo dom CDATA_SECTION_NODE = 4

Definition at line 17 of file dom.js.

dojo dom COMMENT_NODE = 8

Definition at line 21 of file dom.js.

dojo dom copyChildren
Initial value:
 function (srcNode, destNode, trim) {
    var clonedNode = srcNode.cloneNode(true);
    return this.moveChildren(clonedNode, destNode, trim);
}

Definition at line 110 of file dom.js.

dojo dom createDocument
Initial value:
 function () {
    var doc = null;
    var _document = dojo.doc();
    if (!dj_undef("ActiveXObject")) {
        var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
        for (var i = 0; i < prefixes.length; i++) {
            try {
                doc = new ActiveXObject(prefixes[i] + ".XMLDOM");
            }
            catch (e) {
            }
            if (doc) {
                break;
            }
        }
    } else {
        if ((_document.implementation) && (_document.implementation.createDocument)) {
            doc = _document.implementation.createDocument("", "", null);
        }
    }
    return doc;
}

Definition at line 206 of file dom.js.

Definition at line 228 of file dom.js.

dojo dom destroyNode
Initial value:
 function (node) {
    if (node.parentNode) {
        node = dojo.dom.removeNode(node);
    }
    if (node.nodeType != 3) {
        if (dojo.evalObjPath("dojo.event.browser.clean", false)) {
            dojo.event.browser.clean(node);
        }
        if (dojo.render.html.ie) {
            node.outerHTML = "";
        }
    }
}

Definition at line 137 of file dom.js.

dojo dom DOCUMENT_FRAGMENT_NODE = 11

Definition at line 24 of file dom.js.

dojo dom DOCUMENT_NODE = 9

Definition at line 22 of file dom.js.

dojo dom DOCUMENT_TYPE_NODE = 10

Definition at line 23 of file dom.js.

dojo dom dojoml = "http://www.dojotoolkit.org/2004/dojoml"

Definition at line 26 of file dom.js.

dojo dom ELEMENT_NODE = 1

Definition at line 14 of file dom.js.

dojo dom ENTITY_NODE = 6

Definition at line 19 of file dom.js.

dojo dom ENTITY_REFERENCE_NODE = 5

Definition at line 18 of file dom.js.

dojo dom firstElement
Initial value:
 dojo.dom.getFirstChildElement = function (parentNode, tagName) {
    var node = parentNode.firstChild;
    while (node && node.nodeType != dojo.dom.ELEMENT_NODE) {
        node = node.nextSibling;
    }
    if (tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) {
        node = dojo.dom.nextElement(node, tagName);
    }
    return node;
}

Definition at line 47 of file dom.js.

dojo dom getAncestors
Initial value:
 function (node, filterFunction, returnFirstHit) {
    var ancestors = [];
    var isFunction = (filterFunction && (filterFunction instanceof Function || typeof filterFunction == "function"));
    while (node) {
        if (!isFunction || filterFunction(node)) {
            ancestors.push(node);
        }
        if (returnFirstHit && ancestors.length > 0) {
            return ancestors[0];
        }
        node = node.parentNode;
    }
    if (returnFirstHit) {
        return null;
    }
    return ancestors;
}

Definition at line 155 of file dom.js.

Initial value:
 function (node, tag, returnFirstHit) {
    tag = tag.toLowerCase();
    return dojo.dom.getAncestors(node, function (el) {
        return ((el.tagName) && (el.tagName.toLowerCase() == tag));
    }, returnFirstHit);
}

Definition at line 172 of file dom.js.

Initial value:
 function (node, tag) {
    return dojo.dom.getAncestorsByTag(node, tag, true);
}

Definition at line 178 of file dom.js.

dojo dom getUniqueId
Initial value:
 function () {
    var _document = dojo.doc();
    do {
        var id = "dj_unique_" + (++arguments.callee._idIncrement);
    } while (_document.getElementById(id));
    return id;
}

Definition at line 39 of file dom.js.

dojo dom hasParent
Initial value:
 function (node) {
    return Boolean(node && node.parentNode && dojo.dom.isNode(node.parentNode));
}

Definition at line 355 of file dom.js.

dojo dom innerXML
Initial value:
 function (node) {
    if (node.innerXML) {
        return node.innerXML;
    } else {
        if (node.xml) {
            return node.xml;
        } else {
            if (typeof XMLSerializer != "undefined") {
                return (new XMLSerializer()).serializeToString(node);
            }
        }
    }
}

Definition at line 193 of file dom.js.

dojo dom insertAfter
Initial value:
 function (node, ref, force) {
    var pn = ref.parentNode;
    if (ref == pn.lastChild) {
        if ((force != true) && (node === ref)) {
            return false;
        }
        pn.appendChild(node);
    } else {
        return this.insertBefore(node, ref.nextSibling, force);
    }
    return true;
}

Definition at line 279 of file dom.js.

dojo dom insertAtIndex
Initial value:
 function (node, containingNode, insertionIndex) {
    var siblingNodes = containingNode.childNodes;
    if (!siblingNodes.length || siblingNodes.length == insertionIndex) {
        containingNode.appendChild(node);
        return true;
    }
    if (insertionIndex == 0) {
        return dojo.dom.prependChild(node, containingNode);
    }
    return dojo.dom.insertAfter(node, siblingNodes[insertionIndex - 1]);
}

Definition at line 313 of file dom.js.

dojo dom insertAtPosition
Initial value:
 function (node, ref, position) {
    if ((!node) || (!ref) || (!position)) {
        return false;
    }
    switch (position.toLowerCase()) {
      case "before":
        return dojo.dom.insertBefore(node, ref);
      case "after":
        return dojo.dom.insertAfter(node, ref);
      case "first":
        if (ref.firstChild) {
            return dojo.dom.insertBefore(node, ref.firstChild);
        } else {
            ref.appendChild(node);
            return true;
        }
        break;
      default:
        ref.appendChild(node);
        return true;
    }
}

Definition at line 291 of file dom.js.

dojo dom insertBefore
Initial value:
 function (node, ref, force) {
    if ((force != true) && (node === ref || node.nextSibling === ref)) {
        return false;
    }
    var parent = ref.parentNode;
    parent.insertBefore(node, ref);
    return true;
}

Definition at line 271 of file dom.js.

dojo dom isDescendantOf
Initial value:
 function (node, ancestor, guaranteeDescendant) {
    if (guaranteeDescendant && node) {
        node = node.parentNode;
    }
    while (node) {
        if (node == ancestor) {
            return true;
        }
        node = node.parentNode;
    }
    return false;
}

Definition at line 181 of file dom.js.

dojo dom isNode
Initial value:
 function (wh) {
    if (typeof Element == "function") {
        try {
            return wh instanceof Element;
        }
        catch (e) {
        }
    } else {
        return wh && !isNaN(wh.nodeType);
    }
}

Definition at line 28 of file dom.js.

dojo dom isTag
Initial value:
 function (node) {
    if (node && node.tagName) {
        for (var i = 1; i < arguments.length; i++) {
            if (node.tagName == String(arguments[i])) {
                return String(arguments[i]);
            }
        }
    }
    return "";
}

Definition at line 358 of file dom.js.

dojo dom lastElement
Initial value:
 dojo.dom.getLastChildElement = function (parentNode, tagName) {
    var node = parentNode.lastChild;
    while (node && node.nodeType != dojo.dom.ELEMENT_NODE) {
        node = node.previousSibling;
    }
    if (tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) {
        node = dojo.dom.prevElement(node, tagName);
    }
    return node;
}

Definition at line 57 of file dom.js.

dojo dom moveChildren
Initial value:
 function (srcNode, destNode, trim) {
    var count = 0;
    if (trim) {
        while (srcNode.hasChildNodes() && srcNode.firstChild.nodeType == dojo.dom.TEXT_NODE) {
            srcNode.removeChild(srcNode.firstChild);
        }
        while (srcNode.hasChildNodes() && srcNode.lastChild.nodeType == dojo.dom.TEXT_NODE) {
            srcNode.removeChild(srcNode.lastChild);
        }
    }
    while (srcNode.hasChildNodes()) {
        destNode.appendChild(srcNode.firstChild);
        count++;
    }
    return count;
}

Definition at line 94 of file dom.js.

dojo dom nextElement
Initial value:
 dojo.dom.getNextSiblingElement = function (node, tagName) {
    if (!node) {
        return null;
    }
    do {
        node = node.nextSibling;
    } while (node && node.nodeType != dojo.dom.ELEMENT_NODE);
    if (node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) {
        return dojo.dom.nextElement(node, tagName);
    }
    return node;
}

Definition at line 67 of file dom.js.

dojo dom NOTATION_NODE = 12

Definition at line 25 of file dom.js.

dojo dom prependChild
Initial value:
 function (node, parent) {
    if (parent.firstChild) {
        parent.insertBefore(node, parent.firstChild);
    } else {
        parent.appendChild(node);
    }
    return true;
}

Definition at line 263 of file dom.js.

dojo dom prevElement
Initial value:
 dojo.dom.getPreviousSiblingElement = function (node, tagName) {
    if (!node) {
        return null;
    }
    if (tagName) {
        tagName = tagName.toLowerCase();
    }
    do {
        node = node.previousSibling;
    } while (node && node.nodeType != dojo.dom.ELEMENT_NODE);
    if (node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) {
        return dojo.dom.prevElement(node, tagName);
    }
    return node;
}

Definition at line 79 of file dom.js.

Definition at line 20 of file dom.js.

dojo dom removeChildren
Initial value:
 function (node) {
    var count = node.childNodes.length;
    while (node.hasChildNodes()) {
        dojo.dom.removeNode(node.firstChild);
    }
    return count;
}

Definition at line 127 of file dom.js.

dojo dom removeNode
Initial value:
 function (node) {
    if (node && node.parentNode) {
        return node.parentNode.removeChild(node);
    }
}

Definition at line 150 of file dom.js.

dojo dom replaceChildren
Initial value:
 function (node, newChild) {
    var nodes = [];
    if (dojo.render.html.ie) {
        for (var i = 0; i < node.childNodes.length; i++) {
            nodes.push(node.childNodes[i]);
        }
    }
    dojo.dom.removeChildren(node);
    node.appendChild(newChild);
    for (var i = 0; i < nodes.length; i++) {
        dojo.dom.destroyNode(nodes[i]);
    }
}

Definition at line 114 of file dom.js.

dojo dom replaceNode
Initial value:
 function (node, newNode) {
    return node.parentNode.replaceChild(newNode, node);
}

Definition at line 134 of file dom.js.

dojo dom setAttributeNS
Initial value:
 function (elem, namespaceURI, attrName, attrValue) {
    if (elem == null || ((elem == undefined) && (typeof elem == "undefined"))) {
        dojo.raise("No element given to dojo.dom.setAttributeNS");
    }
    if (!((elem.setAttributeNS == undefined) && (typeof elem.setAttributeNS == "undefined"))) {
        elem.setAttributeNS(namespaceURI, attrName, attrValue);
    } else {
        var ownerDoc = elem.ownerDocument;
        var attribute = ownerDoc.createNode(2, attrName, namespaceURI);
        attribute.nodeValue = attrValue;
        elem.setAttributeNode(attribute);
    }
}

Definition at line 368 of file dom.js.

dojo dom TEXT_NODE = 3

Definition at line 16 of file dom.js.

dojo dom textContent

Definition at line 324 of file dom.js.

dojo dom xmlns = {svg:"http://www.w3.org/2000/svg", smil:"http://www.w3.org/2001/SMIL20/", mml:"http://www.w3.org/1998/Math/MathML", cml:"http://www.xml-cml.org", xlink:"http://www.w3.org/1999/xlink", xhtml:"http://www.w3.org/1999/xhtml", xul:"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", xbl:"http://www.mozilla.org/xbl", fo:"http://www.w3.org/1999/XSL/Format", xsl:"http://www.w3.org/1999/XSL/Transform", xslt:"http://www.w3.org/1999/XSL/Transform", xi:"http://www.w3.org/2001/XInclude", xforms:"http://www.w3.org/2002/01/xforms", saxon:"http://icl.com/saxon", xalan:"http://xml.apache.org/xslt", xsd:"http://www.w3.org/2001/XMLSchema", dt:"http://www.w3.org/2001/XMLSchema-datatypes", xsi:"http://www.w3.org/2001/XMLSchema-instance", rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#", rdfs:"http://www.w3.org/2000/01/rdf-schema#", dc:"http://purl.org/dc/elements/1.1/", dcq:"http://purl.org/dc/qualifiers/1.0", "soap-env":"http://schemas.xmlsoap.org/soap/envelope/", wsdl:"http://schemas.xmlsoap.org/wsdl/", AdobeExtensions:"http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"}

Definition at line 27 of file dom.js.

For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo

© 2008-2011 Support Incident Tracker

Tsohost Logo