Return node index list from Javascript as string instead of list so we don't have to join it in C++

This commit is contained in:
Joe Ferris 2011-02-25 22:33:47 -05:00
parent 54d7df3c4c
commit 879eeba471
2 changed files with 2 additions and 12 deletions

View File

@ -17,17 +17,7 @@ void Find::receivedArgument(const char *xpath) {
QVariant result = page()->mainFrame()->evaluateJavaScript(javascript);
if (result.isValid()) {
QVariantList nodes = result.toList();
bool addComma = false;
double node;
for (int i = 0; i < nodes.size(); i++) {
node = nodes[i].toDouble();
if (addComma)
response.append(",");
response.append(QString::number(node));
addComma = true;
}
response = result.toString();
std::cout << "<< Got result:" << std::endl;
std::cout << response.toAscii().data() << std::endl;

View File

@ -11,7 +11,7 @@ Capybara = {
this.nodes[this.nextIndex] = node;
results.push(this.nextIndex);
}
return results;
return results.join(",");
},
attribute: function (index, name) {