Or do I have to do something like this:
var nodes = document.childNodes;
for (var i in nodes) {
if (window.getComputedStyle(nodes[i], null).getPropertyValue('someproperty') == 'somevalue')
// do stuff
}
Edit:
I'm not very familiar with XPath. A 'simple' stab at the problem would be something like this:
function test() {
var resultSet = document.evaluate("//*[@float='left']", document.body, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < resultSet.snapshotLength; i++) {
var element = resultSet.snapshotItem(i);
alert(element);
}
}
But unsurprisingly this doesn't work, since float
is a property, not an attribute...