elementtree
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -0,1 +1,7 @@ | ||
elementtree v0.1.5 (in development) | ||
* Fix a bug in the find() and findtext() method which could manifest itself | ||
under some conditions. | ||
[metagriffin] | ||
elementtree v0.1.4 | ||
@@ -2,0 +8,0 @@ |
@@ -321,6 +321,6 @@ /** | ||
function find(element, path) { | ||
var resultElement = findall(element, path); | ||
var resultElements = findall(element, path); | ||
if (resultElement) { | ||
return resultElement[0]; | ||
if (resultElements && resultElements.length > 0) { | ||
return resultElements[0]; | ||
} | ||
@@ -334,3 +334,3 @@ | ||
if (resultElements) { | ||
if (resultElements && resultElements.length > 0) { | ||
return resultElements[0].text; | ||
@@ -337,0 +337,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
"description": "XML Serialization and Parsing module based on Python's ElementTree.", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"keywords": [ "xml", "sax", "parser", "seralization", "elementtree" ], | ||
@@ -12,0 +12,0 @@ "homepage": "https://github.com/racker/node-elementtree", |
@@ -278,1 +278,23 @@ /** | ||
}; | ||
exports['test_find_null'] = function(test, assert) { | ||
var root = Element('root'); | ||
var node = SubElement(root, 'node'); | ||
var leaf = SubElement(node, 'leaf'); | ||
leaf.text = 'ipsum'; | ||
assert.equal(root.find('node/leaf'), leaf); | ||
assert.equal(root.find('no-such-node/leaf'), null); | ||
test.finish(); | ||
}; | ||
exports['test_findtext_null'] = function(test, assert) { | ||
var root = Element('root'); | ||
var node = SubElement(root, 'node'); | ||
var leaf = SubElement(node, 'leaf'); | ||
leaf.text = 'ipsum'; | ||
assert.equal(root.findtext('node/leaf'), 'ipsum'); | ||
assert.equal(root.findtext('no-such-node/leaf'), null); | ||
test.finish(); | ||
}; |
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
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
53714
1313