From 879eeba471d13671f49a61970de87863be6226a2 Mon Sep 17 00:00:00 2001 From: Joe Ferris Date: Fri, 25 Feb 2011 22:33:47 -0500 Subject: [PATCH] Return node index list from Javascript as string instead of list so we don't have to join it in C++ --- src/Find.cpp | 12 +----------- src/capybara.js | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Find.cpp b/src/Find.cpp index 14df77d..1c1747a 100644 --- a/src/Find.cpp +++ b/src/Find.cpp @@ -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; diff --git a/src/capybara.js b/src/capybara.js index c299c5e..a00f3d6 100644 --- a/src/capybara.js +++ b/src/capybara.js @@ -11,7 +11,7 @@ Capybara = { this.nodes[this.nextIndex] = node; results.push(this.nextIndex); } - return results; + return results.join(","); }, attribute: function (index, name) {