B
Bob Tinsman
This problem shows up in Firefox 1.5.0.1 and Rhino 1.6R2.
I've found that if I have an XML node expression that ends in a filter,
I can't use it with the delete operator. In the following example, the
delete operation has no effect:
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
alert(z.foo.(@a == '2'));
delete z.foo.(@a == '2');
even though the expression is valid. I've come up with the following
grim-looking workaround:
function deleteNodes(node, expr) {
for each (i in eval('node.' + expr)) {
eval('delete node.' + expr + '[0]');
}
}
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
deleteNodes(z, "foo.(@a == '2')");
which does what I want.
Is this by design? It's really annoying that I can't use delete this
way. The problem shows up in Firefox 1.5.0.1 and Rhino 1.6R2. I've
found that if I have an XML node expression that ends in a filter,
I can't use it with the delete operator. In the following example, the
delete operation has no effect:
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
alert(z.foo.(@a == '2'));
delete z.foo.(@a == '2');
even though the expression is valid. I've come up with the following
grim-looking workaround:
function deleteNodes(node, expr) {
for each (i in eval('node.' + expr)) {
eval('delete node.' + expr + '[0]');
}
}
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
deleteNodes(z, "foo.(@a == '2')");
which does what I want.
Is this by design? It's really annoying that I can't use delete this
way. The problem shows up in Firefox 1.5.0.1 and Rhino 1.6R2.
I've found that if I have an XML node expression that ends in a filter,
I can't use it with the delete operator. In the following example, the
delete operation has no effect:
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
alert(z.foo.(@a == '2'));
delete z.foo.(@a == '2');
even though the expression is valid. I've come up with the following
grim-looking workaround:
function deleteNodes(node, expr) {
for each (i in eval('node.' + expr)) {
eval('delete node.' + expr + '[0]');
}
}
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
deleteNodes(z, "foo.(@a == '2')");
which does what I want.
Is this by design? It's really annoying that I can't use delete this
way. The problem shows up in Firefox 1.5.0.1 and Rhino 1.6R2. I've
found that if I have an XML node expression that ends in a filter,
I can't use it with the delete operator. In the following example, the
delete operation has no effect:
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
alert(z.foo.(@a == '2'));
delete z.foo.(@a == '2');
even though the expression is valid. I've come up with the following
grim-looking workaround:
function deleteNodes(node, expr) {
for each (i in eval('node.' + expr)) {
eval('delete node.' + expr + '[0]');
}
}
var z = <abc><foo a='1'>1</foo><foo a='2'>2</foo></abc>;
deleteNodes(z, "foo.(@a == '2')");
which does what I want.
Is this by design? It's really annoying that I can't use delete this
way. The problem shows up in Firefox 1.5.0.1 and Rhino 1.6R2.