Comparing version 0.1.2 to 0.1.4
@@ -5,4 +5,4 @@ // TODO: add on other levels | ||
exports.browserAugmentation = require("./jsdom/browser").browserAugmentation; | ||
exports.windowAugmentation = require("./jsdom/browser").windowAugmentation; | ||
/* | ||
@@ -9,0 +9,0 @@ Proposed API |
@@ -5,3 +5,3 @@ /* | ||
var core = { | ||
// Returns Array | ||
@@ -31,6 +31,6 @@ mapDOMNodes : function(parent, recursive, callback) { | ||
}, | ||
markTreeReadonly : function(el) { | ||
el._readonly = true; | ||
// mark children readonly | ||
@@ -53,8 +53,10 @@ if (el.children) { | ||
core.DOMException = function(code) { | ||
core.DOMException = function(code, msg) { | ||
this._code = code; | ||
this._msg = msg || "" | ||
}; | ||
core.DOMException.prototype = { | ||
get code() { return this._code;} | ||
get code() { return this._code;}, | ||
get msg() { return thise._msg; } | ||
}; | ||
@@ -87,3 +89,3 @@ | ||
}, | ||
// Array Remove - By John Resig (MIT Licensed) | ||
@@ -118,3 +120,3 @@ remove : function(from, to) { | ||
}, | ||
/* returns Node */ | ||
@@ -138,4 +140,4 @@ item : function(index) { | ||
for (var i in this._features) { | ||
if (this._features.hasOwnProperty(i) && | ||
i.toLowerCase() === feature.toLowerCase() && | ||
if (this._features.hasOwnProperty(i) && | ||
i.toLowerCase() === feature.toLowerCase() && | ||
(this._features[i] === version || !version)) | ||
@@ -168,3 +170,3 @@ { | ||
get CDATA_SECTION_NODE() { return 4;}, | ||
get ENTITY_REFERENCE_NODE() { return 5;}, | ||
get ENTITY_REFERENCE_NODE() { return 5;}, | ||
get ENTITY_NODE() { return 6;}, | ||
@@ -180,6 +182,6 @@ get PROCESSING_INSTRUCTION_NODE() { return 7;}, | ||
get nodeValue() { return this._nodeValue;}, | ||
set nodeValue(value) { | ||
set nodeValue(value) { | ||
// readonly | ||
if (this.readonly === true) { | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR, 'Attempting to modify a read-only node'); | ||
} | ||
@@ -190,10 +192,10 @@ | ||
get parentNode() { return this._parentNode;}, | ||
get nodeName() { | ||
get nodeName() { | ||
var name = this._nodeName || this._tagName; | ||
if (this.nodeType === this.ELEMENT_NODE && | ||
this.ownerDocument && | ||
this.ownerDocument && | ||
this.ownerDocument.doctype && | ||
this.ownerDocument.doctype.name.indexOf("html") !== -1) | ||
{ | ||
this.ownerDocument.doctype.name.indexOf("html") !== -1) | ||
{ | ||
return name.toUpperCase(); | ||
@@ -203,6 +205,6 @@ } | ||
}, | ||
set nodeName() { throw new core.DOMException();}, | ||
set nodeName() { throw new core.DOMException();}, | ||
get attributes() { return this._attributes;}, | ||
get firstChild() { | ||
return (this._children && this._children.length && this._children.item(0)) ? | ||
get firstChild() { | ||
return (this._children && this._children.length && this._children.item(0)) ? | ||
this._children.item(0) : | ||
@@ -214,6 +216,6 @@ null; | ||
get readonly() { return this._readonly;}, | ||
get lastChild() { | ||
if (this._children && | ||
this._children.length && | ||
get lastChild() { | ||
if (this._children && | ||
this._children.length && | ||
this._children[this._children.length-1]) | ||
@@ -230,10 +232,10 @@ { | ||
get nextSibling() { | ||
get nextSibling() { | ||
// find this node's index in the parentNode, add one and call it a day | ||
var index = 0; | ||
if (!this._parentNode || | ||
!this._parentNode.childNodes || | ||
!this._parentNode.childNodes.length || | ||
this._parentNode.childNodes.length < 2) | ||
if (!this._parentNode || | ||
!this._parentNode.childNodes || | ||
!this._parentNode.childNodes.length || | ||
this._parentNode.childNodes.length < 2) | ||
{ | ||
@@ -250,3 +252,3 @@ return null; | ||
} | ||
// TODO: there is some subtle weirdness here. | ||
@@ -256,3 +258,3 @@ if (this._parentNode.childNodes.item(index) === this) { | ||
} | ||
return this._parentNode.childNodes.item(index) || null; | ||
@@ -262,10 +264,10 @@ }, | ||
get previousSibling() { | ||
get previousSibling() { | ||
// find this node's index in the parentNode, add one and call it a day | ||
var index = 0; | ||
if (!this._parentNode || | ||
!this._parentNode.childNodes || | ||
!this._parentNode.childNodes.length || | ||
this._parentNode.childNodes.length < 1) | ||
if (!this._parentNode || | ||
!this._parentNode.childNodes || | ||
!this._parentNode.childNodes.length || | ||
this._parentNode.childNodes.length < 1) | ||
{ | ||
@@ -277,3 +279,3 @@ return null; | ||
while ((currentNode = this._parentNode.childNodes[index])) { | ||
if (currentNode === this) { | ||
if (currentNode === this) { | ||
break; | ||
@@ -288,3 +290,3 @@ } | ||
/* returns Node */ | ||
/* returns Node */ | ||
insertBefore : function(/* Node */ newChild, /* Node*/ refChild){ | ||
@@ -294,3 +296,3 @@ | ||
if (this.readonly === true) { | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR, 'Attempting to modify a read-only node'); | ||
} | ||
@@ -301,3 +303,3 @@ | ||
} | ||
if (newChild.ownerDocument !== this.ownerDocument) { | ||
@@ -308,3 +310,3 @@ throw new core.DOMException(WRONG_DOCUMENT_ERR); | ||
var found = false; | ||
// if the newChild is already in the tree elsewhere, remove it first | ||
@@ -329,3 +331,3 @@ if (newChild._parentNode) { | ||
} | ||
} | ||
} | ||
@@ -338,3 +340,3 @@ // fragments are merged into the element | ||
var child; | ||
for (j=0;j<length;j++) | ||
@@ -353,3 +355,3 @@ { | ||
} | ||
if (!found) { | ||
@@ -359,3 +361,3 @@ throw new core.DOMException(NOT_FOUND_ERR); | ||
return newChild; | ||
} | ||
} | ||
}, // raises(DOMException); | ||
@@ -368,9 +370,9 @@ | ||
if (this.readonly === true) { | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR, 'Attempting to modify a read-only node'); | ||
} | ||
if (newChild.nodeType === this.ATTRIBUTE_NODE) { | ||
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | ||
} | ||
// moving elements across documents | ||
@@ -380,3 +382,3 @@ if (newChild.ownerDocument !== this.ownerDocument) { | ||
} | ||
for (var i=0;i<this._children.length;i++) | ||
@@ -392,3 +394,3 @@ { | ||
} | ||
this._children.remove(i,i); | ||
@@ -411,3 +413,3 @@ | ||
} | ||
return oldChild; | ||
@@ -421,3 +423,3 @@ } | ||
removeChild : function(/* Node */ oldChild){ | ||
// readonly | ||
@@ -427,3 +429,3 @@ if (this.readonly === true) { | ||
} | ||
var found = false; | ||
@@ -442,3 +444,3 @@ for (var i=0;i<this._children.length;i++) { | ||
} | ||
if (this.nodeType === this.DOCUMENT_NODE) { | ||
@@ -449,11 +451,11 @@ if (this._documentElement === oldChild) { | ||
} | ||
return oldChild; | ||
} | ||
} | ||
// node was not found. | ||
throw new core.DOMException(NOT_FOUND_ERR); | ||
}, // raises(DOMException); | ||
/* returns Node */ | ||
@@ -465,7 +467,7 @@ appendChild : function(/* Node */ newChild){ | ||
} | ||
if (newChild.nodeType === this.ATTRIBUTE_NODE) { | ||
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | ||
} | ||
// avoid recursion | ||
@@ -478,17 +480,17 @@ var cur = this; | ||
} while ((cur = cur._parentNode)) | ||
// only elements created with this.ownerDocument can be added here | ||
if (newChild.ownerDocument && | ||
this.ownerDocument && | ||
if (newChild.ownerDocument && | ||
this.ownerDocument && | ||
newChild.ownerDocument !== this.ownerDocument) { | ||
throw new core.DOMException(WRONG_DOCUMENT_ERR); | ||
} | ||
try { | ||
this.removeChild(newChild); | ||
} catch (e) { /* do nothing */ } | ||
// fragments are merged into the element | ||
if (newChild.nodeType === this.DOCUMENT_FRAGMENT_NODE) { | ||
var transfer = []; | ||
@@ -508,3 +510,3 @@ var length = newChild.children.length; | ||
} | ||
} else { | ||
@@ -514,3 +516,3 @@ if (newChild && newChild.parentNode) { | ||
} | ||
// Attach the parent node. | ||
@@ -527,6 +529,6 @@ newChild._parentNode = this; | ||
} | ||
return newChild; | ||
}, // raises(DOMException); | ||
/* returns boolean */ | ||
@@ -536,8 +538,8 @@ hasChildNodes : function() { | ||
}, | ||
/* returns Node */ | ||
/* returns Node */ | ||
cloneNode : function(/* bool */ deep) { | ||
var object = null; | ||
var attrCopy = function(src, dest) { | ||
@@ -547,3 +549,3 @@ if (src.attributes && src.attributes.length) { | ||
{ | ||
dest.setAttribute(src.attributes.item(i).nodeName, | ||
dest.setAttribute(src.attributes.item(i).nodeName, | ||
src.attributes.item(i).nodeValue); | ||
@@ -554,5 +556,5 @@ } | ||
}; | ||
switch (this.nodeType) { | ||
case this.ELEMENT_NODE: | ||
@@ -584,3 +586,3 @@ object = attrCopy(this,this.ownerDocument.createElement(this.tagName)); | ||
case this.PROCESSING_INSTRUCTION_NODE: | ||
var pi = this.ownerDocument.createProcessingInstruction(this._target, | ||
var pi = this.ownerDocument.createProcessingInstruction(this._target, | ||
this._data); | ||
@@ -606,4 +608,4 @@ object = attrCopy(this, pi); | ||
case this.NOTATION_NODE: | ||
object = this.ownerDocument.createNotationNode(this._name, | ||
this._publicId, | ||
object = this.ownerDocument.createNotationNode(this._name, | ||
this._publicId, | ||
this._systemId); | ||
@@ -633,10 +635,10 @@ object = attrCopy(this,object); | ||
} | ||
return object; | ||
}, | ||
/* returns void */ | ||
normalize: function() { | ||
var prevChild, child, attr,i; | ||
if (this._attributes && this._attributes.length) { | ||
@@ -650,7 +652,7 @@ for (i=0;i<this._attributes.length;i++) | ||
} | ||
for (i=0;i<this._children.length;i++) | ||
{ | ||
child = this._children[i]; | ||
if (child.normalize) { | ||
@@ -662,17 +664,17 @@ child.normalize(); | ||
prevChild = this._children[i-1]; | ||
if (child.nodeType === this.TEXT_NODE && | ||
if (child.nodeType === this.TEXT_NODE && | ||
prevChild.nodeType === this.TEXT_NODE) | ||
{ | ||
// remove the child and decrement i | ||
prevChild.appendData(child.value); | ||
this.removeChild(child); | ||
i--; | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
toString: function() { | ||
@@ -712,3 +714,3 @@ var id = ''; | ||
}, | ||
/* returns Node */ | ||
@@ -726,3 +728,3 @@ getNamedItem: function(/* string */ name) { | ||
} | ||
// arg is from a different document | ||
@@ -737,3 +739,3 @@ if (arg && arg.ownerDocument !== this._ownerDocument) { | ||
} | ||
var ret; | ||
@@ -759,11 +761,11 @@ if (!this._nodes[arg.name] || this._nodes[arg.name] === null) { | ||
} | ||
if (!this._nodes.hasOwnProperty(name)) { | ||
throw new core.DOMException(NOT_FOUND_ERR); | ||
} | ||
var prev = this._nodes[name] || null; | ||
this._nodes[name] = null; | ||
delete this._nodes[name]; | ||
this._length--; | ||
@@ -782,3 +784,3 @@ return prev; | ||
current++; | ||
} | ||
} | ||
} | ||
@@ -792,7 +794,7 @@ return null; | ||
this._parentNode = parentNode; | ||
}; | ||
core.AttrNodeMap.prototype = { | ||
get parentNode() { return this._parentNode;}, | ||
/* returns Node */ | ||
@@ -803,3 +805,3 @@ removeNamedItem: function(/* string */ name) { | ||
var doc = this._ownerDocument; | ||
// set default value if available | ||
@@ -820,3 +822,3 @@ if (doc && doc.doctype && doc.doctype.name.toLowerCase() !== "html") { | ||
return prev; | ||
}, // raises: function(DOMException) {}, | ||
}, // raises: function(DOMException) {}, | ||
}; | ||
@@ -858,11 +860,11 @@ core.AttrNodeMap.prototype.__proto__ = core.NamedNodeMap.prototype; | ||
core.Element.prototype = { | ||
get nodeValue() { return null;}, | ||
set nodeValue(value) { /* do nothing */ }, | ||
get tagName() { | ||
get tagName() { | ||
if (this.nodeType === this.ELEMENT_NODE && | ||
this.ownerDocument && | ||
this.ownerDocument && | ||
this.ownerDocument.doctype && | ||
this.ownerDocument.doctype.name.indexOf("html") !== -1) | ||
{ | ||
this.ownerDocument.doctype.name.indexOf("html") !== -1) | ||
{ | ||
return this.nodeName.toUpperCase(); | ||
@@ -874,3 +876,3 @@ } | ||
get attributes() { return this._attributes;}, | ||
get name() { return this.nodeName;}, | ||
get name() { return this.nodeName;}, | ||
/* returns string */ | ||
@@ -887,3 +889,3 @@ getAttribute: function(/* string */ name) { | ||
setAttribute: function(/* string */ name, /* string */ value) { | ||
// readonly | ||
@@ -893,11 +895,11 @@ if (this.readonly === true) { | ||
} | ||
if (this._attributes === null) { | ||
this._attributes = new core.AttrNodeMap(this.ownerDocument, this); | ||
} | ||
if (this.ownerDocument) { | ||
var attr = this.ownerDocument.createAttribute(name); | ||
attr.value = value; | ||
if (this.attributes.exists(name)) { | ||
@@ -935,3 +937,3 @@ this._attributes.removeNamedItem(name); | ||
} | ||
return this._attributes.getNamedItem(name); | ||
@@ -951,3 +953,3 @@ }, | ||
} | ||
// only attributes created with this.ownerDocument can be added here | ||
@@ -974,6 +976,6 @@ if (newAttr.ownerDocument !== this.ownerDocument) { | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | ||
} | ||
} | ||
var existingAttr = this._attributes.getNamedItem(oldAttr.name); | ||
if (this._attributes && existingAttr === oldAttr) { | ||
@@ -985,8 +987,8 @@ this._attributes.removeNamedItem(oldAttr.name); | ||
}, //raises: function(DOMException) {}, | ||
/* returns NodeList */ | ||
/* returns NodeList */ | ||
getElementsByTagName: function(/* string */ name) { | ||
var queryFunction = function(child) { | ||
if (child.nodeType && child.nodeType === | ||
core.Node.prototype.ENTITY_REFERENCE_NODE) | ||
if (child.nodeType && child.nodeType === | ||
core.Node.prototype.ENTITY_REFERENCE_NODE) | ||
{ | ||
@@ -1000,7 +1002,7 @@ child = child._entity; | ||
return true; | ||
// case insensitivity for html | ||
} else if (child.ownerDocument && child.ownerDocument.doctype && | ||
} else if (child.ownerDocument && child.ownerDocument.doctype && | ||
child.ownerDocument.doctype.name === "html" && | ||
child.nodeName.toLowerCase() === name.toLowerCase()) | ||
child.nodeName.toLowerCase() === name.toLowerCase()) | ||
{ | ||
@@ -1015,5 +1017,5 @@ return true; | ||
if (this.ownerDocument && | ||
this.ownerDocument.implementation && | ||
this.ownerDocument.implementation.hasFeature("DisableLiveLists")) | ||
if (this.ownerDocument && | ||
this.ownerDocument.implementation && | ||
this.ownerDocument.implementation.hasFeature("DisableLiveLists")) | ||
{ | ||
@@ -1075,3 +1077,3 @@ return core.mapDOMNodes(this, true, queryFunction); | ||
set doctype(doctype) { this._doctype = doctype;}, | ||
get documentElement() { | ||
get documentElement() { | ||
if (this._documentElement) { | ||
@@ -1090,12 +1092,12 @@ return this._documentElement; | ||
}, | ||
get implementation() { return this._implementation;}, | ||
set implementation(implementation) { this._implementation = implementation;}, | ||
get nodeType() { return this.DOCUMENT_NODE;}, | ||
get nodeName() { | ||
get nodeName() { | ||
if (this.nodeType === this.ELEMENT_NODE && | ||
this.ownerDocument && | ||
this.ownerDocument && | ||
this.ownerDocument.doctype && | ||
this.ownerDocument.doctype.name.indexOf("html") !== -1) | ||
{ | ||
this.ownerDocument.doctype.name.indexOf("html") !== -1) | ||
{ | ||
return this._nodeName.toUpperCase(); | ||
@@ -1110,4 +1112,5 @@ } | ||
createElement: function(/* string */ tagName) { | ||
if (!tagName || !tagName.match || tagName.match(/[^\w:\d_-]+/i)) { | ||
throw new core.DOMException(INVALID_CHARACTER_ERR); | ||
var c = []; | ||
if (!tagName || !tagName.match || (c = tagName.match(/[^\w:\d_-]+/i))) { | ||
throw new core.DOMException(INVALID_CHARACTER_ERR, 'Invalid character in tag name: ' + c.pop()); | ||
} | ||
@@ -1131,16 +1134,16 @@ | ||
} | ||
} | ||
} | ||
return element; | ||
}, //raises: function(DOMException) {}, | ||
/* returns DocumentFragment */ | ||
/* returns DocumentFragment */ | ||
createDocumentFragment: function() { | ||
return new core.DocumentFragment(this); | ||
}, | ||
/* returns Text */ | ||
/* returns Text */ | ||
createTextNode: function(/* string */ data) { | ||
return new core.Text(this,data); | ||
}, | ||
/* returns Comment */ | ||
@@ -1150,4 +1153,4 @@ createComment: function(/* string */ data) { | ||
}, | ||
/* returns CDATASection */ | ||
/* returns CDATASection */ | ||
createCDATASection: function(/* string */ data) { | ||
@@ -1157,3 +1160,3 @@ if (this.doctype && this.doctype.name === "html") { | ||
} | ||
return new core.CDATASection(this,data); | ||
@@ -1164,7 +1167,7 @@ }, // raises: function(DOMException) {}, | ||
createProcessingInstruction: function(/* string */ target,/* string */ data) { | ||
if (this.doctype && this.doctype.name === "html") { | ||
throw new core.DOMException(NOT_SUPPORTED_ERR); | ||
} | ||
if (target.match(/[^\w\d_-]+/) || !target || !target.length) { | ||
@@ -1184,3 +1187,3 @@ throw new core.DOMException(INVALID_CHARACTER_ERR); | ||
}, // raises: function(DOMException) {}, | ||
/* returns EntityReference */ | ||
@@ -1213,10 +1216,10 @@ createEntityReference: function(/* string */ name) { | ||
{ | ||
if (name.match(/[^\w\d_\-&;]+/) || !name || !name.length) { | ||
throw new core.DOMException(INVALID_CHARACTER_ERR); | ||
} | ||
var ret = new core.Entity(this, name); | ||
ret._readonly = false;// TODO: fix me please. | ||
for (var i=1;i<arguments.length;i++) | ||
@@ -1228,3 +1231,3 @@ { | ||
core.markTreeReadonly(ret); | ||
return ret; | ||
@@ -1236,10 +1239,10 @@ }, | ||
{ | ||
if (name.match(/[^\w\d_\-&;]+/) || !name || !name.length) { | ||
throw new core.DOMException(INVALID_CHARACTER_ERR); | ||
} | ||
var ret = new core.Notation(this, name, publicId, systemId); | ||
ret._readonly = false;// TODO: fix me please. | ||
for (var i=3;i<arguments.length;i++) | ||
@@ -1251,7 +1254,7 @@ { | ||
core.markTreeReadonly(ret); | ||
return ret; | ||
}, | ||
/* returns Node */ | ||
@@ -1264,9 +1267,9 @@ appendChild : function(/* Node */ newChild){ | ||
} | ||
if (newChild.nodeType === this.ATTRIBUTE_NODE) { | ||
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | ||
} | ||
this._children.push(newChild); | ||
// Attach the parent node. | ||
@@ -1286,3 +1289,3 @@ newChild._parentNode = this; | ||
get data() { return this._nodeValue;}, | ||
set data(data) { | ||
set data(data) { | ||
@@ -1292,21 +1295,21 @@ // readonly | ||
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | ||
} | ||
} | ||
this._nodeValue = data; | ||
}, | ||
/* returns int */ | ||
get length() { return this._nodeValue.length || 0;}, | ||
/* returns string */ | ||
substringData: function(/* int */ offset, /* int */ count) { | ||
if (count < 0 || offset < 0 || offset > this._nodeValue.length) { | ||
throw new core.DOMException(INDEX_SIZE_ERR); | ||
} | ||
return (this._nodeValue.length < offset + count) ? | ||
this._nodeValue.substring(offset) : | ||
return (this._nodeValue.length < offset + count) ? | ||
this._nodeValue.substring(offset) : | ||
this._nodeValue.substring(offset, offset+count); | ||
}, // raises: function(DOMException) {}, | ||
@@ -1321,8 +1324,8 @@ | ||
} | ||
this._nodeValue+=arg; | ||
return this._nodeValue; | ||
}, // raises: function(DOMException) {}, | ||
/* returns string */ | ||
/* returns string */ | ||
insertData: function(/* int */ offset, /* string */ arg) { | ||
@@ -1341,7 +1344,7 @@ | ||
var end = this._nodeValue.substring(offset); | ||
this._nodeValue = start + arg + end; | ||
}, //raises: function(DOMException) {}, | ||
/* returns void */ | ||
@@ -1354,5 +1357,5 @@ deleteData: function(/* int */ offset, /* int */ count) { | ||
} | ||
if (offset < 0 || | ||
offset > this._nodeValue.length || | ||
if (offset < 0 || | ||
offset > this._nodeValue.length || | ||
count < 0) | ||
@@ -1365,7 +1368,7 @@ { | ||
this._nodeValue = (offset+count<this._nodeValue.length) ? | ||
this._nodeValue = (offset+count<this._nodeValue.length) ? | ||
start + this._nodeValue.substring(offset+count) : | ||
start; | ||
}, // raises: function(DOMException) {}, | ||
/* returns void */ | ||
@@ -1379,9 +1382,9 @@ replaceData: function(/* int */ offset, /* int */ count, /* string */ arg) { | ||
count = (offset+count > this._nodeValue.length) ? | ||
count = (offset+count > this._nodeValue.length) ? | ||
this.nodeValue.length-offset : | ||
count; | ||
if (offset < 0 || | ||
offset > this._nodeValue.length || | ||
count < 0 /*|| | ||
if (offset < 0 || | ||
offset > this._nodeValue.length || | ||
count < 0 /*|| | ||
offset+count > this._nodeValue.length*/) | ||
@@ -1394,3 +1397,3 @@ { | ||
var end = this._nodeValue.substring(offset+count); | ||
this._nodeValue = start + arg + end; | ||
@@ -1414,3 +1417,3 @@ } // raises: function(DOMException) {}, | ||
var val = "", child, i, j; | ||
if (this._children.length > 0) { | ||
@@ -1423,3 +1426,3 @@ for (i=0;i<this._children.length;i++) | ||
for (j=0;j<child.childNodes.length;j++) { | ||
val+=(child.childNodes.item(j).nodeValue) ? | ||
val+=(child.childNodes.item(j).nodeValue) ? | ||
child.childNodes.item(j).nodeValue : | ||
@@ -1433,6 +1436,6 @@ child.childNodes.item(j); | ||
} | ||
return val; | ||
}, | ||
set nodeValue(value) { | ||
set nodeValue(value) { | ||
// readonly | ||
@@ -1450,6 +1453,6 @@ if (this._readonly) { | ||
get specified() { return this._specified;}, | ||
get value() { | ||
get value() { | ||
return this.nodeValue; | ||
}, | ||
set value(value) { | ||
set value(value) { | ||
this.nodeValue = value; | ||
@@ -1459,24 +1462,24 @@ }, | ||
get attributes() { return null;}, | ||
insertBefore : function(/* Node */ newChild, /* Node*/ refChild){ | ||
if (newChild.nodeType === this.CDATA_SECTION_NODE || | ||
newChild.nodeType === this.ELEMENT_NODE) | ||
newChild.nodeType === this.ELEMENT_NODE) | ||
{ | ||
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | ||
} | ||
return core.Node.prototype.insertBefore.call(this, newChild, refChild); | ||
}, | ||
appendChild : function(/* Node */ arg) { | ||
if (arg.nodeType === this.CDATA_SECTION_NODE || | ||
arg.nodeType === this.ELEMENT_NODE) | ||
arg.nodeType === this.ELEMENT_NODE) | ||
{ | ||
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | ||
} | ||
return core.Node.prototype.appendChild.call(this, arg); | ||
} | ||
}; | ||
@@ -1491,3 +1494,3 @@ core.Attr.prototype.__proto__ = core.Node.prototype; | ||
core.Text.prototype = { | ||
get attributes() { return null;}, | ||
@@ -1497,3 +1500,3 @@ get nodeType() { return this.TEXT_NODE;}, | ||
set value(value) { this.nodeValue = value;}, | ||
/* returns Text */ | ||
@@ -1551,5 +1554,5 @@ splitText: function(offset) { | ||
this._notations = notations || new core.NotationNodeMap(document); | ||
core.markTreeReadonly(this._notations); | ||
this._attributes = attributes || new core.NamedNodeMap(document); | ||
@@ -1604,3 +1607,3 @@ }; | ||
get nodeValue() { return null;}, | ||
set nodeValue() { | ||
set nodeValue() { | ||
// readonly | ||
@@ -1611,3 +1614,3 @@ if (this.readonly === true) { | ||
} | ||
/* do nothing */ | ||
/* do nothing */ | ||
}, | ||
@@ -1617,11 +1620,11 @@ get name() { return this._name }, | ||
get systemId() { return this._systemId;}, | ||
set publicId(publicId) { this._publicId = publicId;}, | ||
set systemId(systemId) { this._systemId = systemId;}, | ||
set notationName(notationName) { this._notationName = notationName;}, | ||
get notationName() { return this._notationName;}, | ||
get nodeType() { return this.ENTITY_NODE;}, | ||
get attributes() { return null;}, | ||
}; | ||
@@ -1640,3 +1643,3 @@ core.Entity.prototype.__proto__ = core.Node.prototype; | ||
get nodeValue() { return this._entity.nodeValue;}, | ||
set nodeValue() { | ||
set nodeValue() { | ||
// readonly | ||
@@ -1647,7 +1650,7 @@ if (this.readonly === true) { | ||
} | ||
/* do nothing */ | ||
/* do nothing */ | ||
}, | ||
get attributes() { return null;}, | ||
// Proxy to the entity | ||
@@ -1658,3 +1661,3 @@ get nodeName() { return this._entity.nodeName;}, | ||
get lastChild() { return this._entity.lastChild || null;}, | ||
}; | ||
@@ -1661,0 +1664,0 @@ core.EntityReference.prototype.__proto__ = core.Node.prototype; |
{ | ||
"name": "jsdom", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"description": "CommonJS implementation of the DOM intended to be platform independent and as minimal/light as possible while completely adhering to the w3c DOM specifications.", | ||
"keywords": [ | ||
"dom", | ||
"javascript" | ||
"javascript" | ||
], | ||
@@ -13,4 +13,4 @@ "maintainers": [ | ||
"email": "tmpvar@gmail.com", | ||
"web": "http://tmpvar.com" | ||
} | ||
"web": "http://tmpvar.com" | ||
} | ||
], | ||
@@ -20,3 +20,3 @@ "contributors": [ | ||
"name": "Vincent Greene", | ||
"email": "ulteriorlife@gmail.com" | ||
"email": "ulteriorlife@gmail.com" | ||
}, | ||
@@ -30,3 +30,3 @@ { | ||
"mail": "tmpvar@gmail.com", | ||
"web": "http://http://github.com/tmpvar/jsdom/issues" | ||
"web": "http://http://github.com/tmpvar/jsdom/issues" | ||
}, | ||
@@ -36,4 +36,4 @@ "licenses": [ | ||
"type": "MIT", | ||
"url": "http://github.com/tmpvar/jsdom/blob/master/LICENSE.txt" | ||
} | ||
"url": "http://github.com/tmpvar/jsdom/blob/master/LICENSE.txt" | ||
} | ||
], | ||
@@ -43,4 +43,4 @@ "repositories": [ | ||
"type": "git", | ||
"url": "http://github.com/tmpvar/jsdom.git" | ||
} | ||
"url": "http://github.com/tmpvar/jsdom.git" | ||
} | ||
], | ||
@@ -56,3 +56,3 @@ "implements": [ | ||
"macos", | ||
"win" | ||
"win" | ||
], | ||
@@ -62,3 +62,3 @@ "cpu": [ | ||
"ppc", | ||
"x86_64" | ||
"x86_64" | ||
], | ||
@@ -69,8 +69,8 @@ "engines": [ | ||
"node", | ||
"rhino" | ||
"rhino" | ||
], | ||
"directories": { | ||
"lib": "lib" | ||
"lib": "lib" | ||
}, | ||
"main": "./lib/jsdom" | ||
} |
@@ -28,3 +28,3 @@ var sys = require("sys"); | ||
// Compat Layer | ||
global.builder = { | ||
global.builder = { | ||
contentType: "", | ||
@@ -39,4 +39,4 @@ type: "", | ||
fn = require(file); | ||
if (!fn[name]) { | ||
@@ -75,3 +75,3 @@ throw new Error("Test method " + name + " not found.."); | ||
global.builder.type = "xml"; | ||
global.builder.testDirectory = "level1/core"; | ||
global.builder.testDirectory = "level1/core"; | ||
} | ||
@@ -82,3 +82,3 @@ }, | ||
global.builder.type = "html"; | ||
global.builder.testDirectory = "level1/html"; | ||
global.builder.testDirectory = "level1/html"; | ||
} | ||
@@ -89,3 +89,3 @@ }, | ||
global.builder.type = "svg"; | ||
global.builder.testDirectory = "level1/svg"; | ||
global.builder.testDirectory = "level1/svg"; | ||
} | ||
@@ -96,13 +96,13 @@ }, | ||
global.builder.type = "xml"; | ||
global.builder.testDirectory = "level2/core"; | ||
global.builder.testDirectory = "level2/core"; | ||
} | ||
}, | ||
}, | ||
"browser" : { cases: require("./browser").tests, setUp : function() { | ||
global.dom = require(__dirname + "/../lib/jsdom/level1/core").dom.level1.core; | ||
global.browser = require(__dirname + "/../lib/jsdom/browser").browserAugmentation(dom); | ||
global.builder.contentType = "text/html"; | ||
global.builder.type = "html"; | ||
global.builder.testDirectory = "browser"; | ||
global.builder.testDirectory = "browser"; | ||
} | ||
@@ -113,6 +113,6 @@ }, | ||
global.window = require(__dirname + "/../lib/jsdom/browser").windowAugmentation(dom); | ||
global.builder.contentType = "text/html"; | ||
global.builder.type = "html"; | ||
global.builder.testDirectory = "browser"; | ||
global.builder.testDirectory = "browser"; | ||
} | ||
@@ -126,3 +126,3 @@ } | ||
global.builder.type = "html"; | ||
global.builder.testDirectory = "level2/html"; | ||
global.builder.testDirectory = "level2/html"; | ||
} | ||
@@ -133,3 +133,3 @@ }, | ||
global.builder.type = "xml"; | ||
global.builder.testDirectory = "level3/core"; | ||
global.builder.testDirectory = "level3/core"; | ||
} | ||
@@ -140,3 +140,3 @@ }, | ||
global.builder.type = "html"; | ||
global.builder.testDirectory = "level3/ls"; | ||
global.builder.testDirectory = "level3/ls"; | ||
} | ||
@@ -147,2 +147,2 @@ } | ||
require("mjsunit.runner/lib/runner").run(suites); | ||
require("mjsunit.runner/runner").run(suites); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
129207
83755022