Sha256: 5f3fad303a1a22ec1f0728c86062955ccdaf53666c1eb49067482f58bede79c9

Contents?: true

Size: 1.54 KB

Versions: 11

Compression:

Stored size: 1.54 KB

Contents

$debug("Defining Attr");
/*
* Attr - DOM Level 2
*/
/**
 * @class  DOMAttr - The Attr interface represents an attribute 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 DOMAttr = function(ownerDocument) {
    this.DOMNode = DOMNode;
    this.DOMNode(ownerDocument);
                   
    this.ownerElement = null;               // set when Attr is added to NamedNodeMap
};
DOMAttr.prototype = new DOMNode; 
__extend__(DOMAttr.prototype, {
    // the name of this attribute
    get name(){
        return this.nodeName;
    },
    set name(name){
        this.nodeName = name;
    },
    // the value of the attribute is returned as a string
    get value(){
        return this.nodeValue;
    },
    set value(value){
        // throw Exception if Attribute is readonly
        if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
            throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
        }
        // delegate to node
        this.nodeValue = value;
    },
    get specified(){
        return (this!==null&&this!=undefined);
    },
    get nodeType(){
        return DOMNode.ATTRIBUTE_NODE;
    },
    get xml(){
        if(this.nodeValue)
            return ' '+this.nodeName + '="' + __escapeXML__(this.nodeValue+"") + '"';
        else
            return '';
    },
    toString : function(){
        return "Attr #" + this._id + " " + this.name;
    }
});

// $w.Attr = DOMAttr;

Version data entries

11 entries across 11 versions & 2 rubygems

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