Sha256: 913f6ba12613331ba176bb1a31fdeefac433aa6562287289d088524dd3b6d515

Contents?: true

Size: 1.6 KB

Versions: 11

Compression:

Stored size: 1.6 KB

Contents

/**
 * @class  DOMNamespace - The Namespace interface represents an namespace in an Element object
 *
 * @extends DOMNode
 * @author Jon van Noort (jon@webarcana.com.au)
 * @param  ownerDocument : DOMDocument - The Document object associated with this node.
 */
var DOMNamespace = function(ownerDocument) {
  this.DOMNode = DOMNode;
  this.DOMNode(ownerDocument);

  this.name      = "";                           // the name of this attribute

  // If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false.
  // Note that the implementation is in charge of this attribute, not the user.
  // If the user changes the value of the attribute (even if it ends up having the same value as the default value)
  // then the specified flag is automatically flipped to true
  this.specified = false;
};
DOMNamespace.prototype = new DOMNode;
__extend__(DOMNamespace.prototype, {
    get value(){
        // the value of the attribute is returned as a string
        return this.nodeValue;
    },
    set value(value){
        this.nodeValue = value+'';
    },
    get nodeType(){
        return DOMNode.NAMESPACE_NODE;
    },
    get xml(){
        var ret = "";

          // serialize Namespace Declaration
          if (this.name != "") {
            ret += this.name +"=\""+ __escapeXML__(this.nodeValue) +"\"";
          }
          else {  // handle default namespace
            ret += "xmlns=\""+ __escapeXML__(this.nodeValue) +"\"";
          }
        
          return ret;
    },
    toString: function(){
        return "Namespace " + this.name + "=" + this.value;
    }
});

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
envjs19-0.3.8.20101029121421 src/dom/namespace.js
envjs-0.3.8 src/dom/namespace.js
envjs-0.3.7 src/dom/namespace.js
envjs-0.3.6 src/dom/namespace.js
envjs-0.3.5 src/dom/namespace.js
envjs-0.3.4 src/dom/namespace.js
envjs-0.3.3 src/dom/namespace.js
envjs-0.3.2 src/dom/namespace.js
envjs-0.3.1 src/dom/namespace.js
envjs-0.3.0 src/dom/namespace.js
envjs-0.2.0 src/dom/namespace.js