From 66cc5c75004955ff41cfe86d30f2b2985f4d0698 Mon Sep 17 00:00:00 2001 From: Arvind Date: Wed, 10 Jul 2013 17:59:35 +0530 Subject: [PATCH] Fixing iteration over xpath and where for highlights --- static/text-annotation.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/text-annotation.js b/static/text-annotation.js index 2902ba1..32ece6f 100644 --- a/static/text-annotation.js +++ b/static/text-annotation.js @@ -51,7 +51,12 @@ var attributes = {}; backdrop: false, }); $('.well a').click(function(event){ - xpath = $(event.currentTarget).text().split('#')[1]; + if($(event.currentTarget).text().search('#')){ + len = $(event.currentTarget).text().split('#').len(); + xpath = $(event.currentTarget).text().split('#')[len-1]; + } + else + xpath = $(event.currentTarget).text(); var nodes = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE,null); result = nodes.iterateNext(); while(result){ -- 1.7.10.4