From 80cbb6c178a7cc98fe244c0410f024cacf9d6694 Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sat, 30 Jan 2010 22:17:01 -0800 Subject: Recognize elements with "onclick" attributes in link hints. Fixes #72, although it makes Reddit look pretty messy since each link now has 3 letters. --- linkHints.js | 2 +- test_harnesses/page_with_links.html | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/linkHints.js b/linkHints.js index d5ed9352..2c085ff7 100644 --- a/linkHints.js +++ b/linkHints.js @@ -18,7 +18,7 @@ var linkHintsCssAdded = false; // An XPath describing what a clickable element is. We could also look for images with an onclick // attribute, but let's wait to see if that really is necessary. -var clickableElementsXPath = "//a | //textarea | //button | //select | //input[not(@type='hidden')]"; +var clickableElementsXPath = "//a | //textarea | //button | //select | //input[not(@type='hidden')] | //*[@onclick]"; // We need this as a top-level function because our command system doesn't yet support arguments. function activateLinkHintsModeToOpenInNewTab() { activateLinkHintsMode(true); } diff --git a/test_harnesses/page_with_links.html b/test_harnesses/page_with_links.html index 5e0679f4..83937595 100644 --- a/test_harnesses/page_with_links.html +++ b/test_harnesses/page_with_links.html @@ -19,7 +19,7 @@ a#paddingLinkTop { padding-top:50px; } - + @@ -27,7 +27,7 @@



- + This link has a lot of vertical padding

@@ -36,5 +36,14 @@

This link has a lot of vertical padding on the top + +

+

+
div with an onclick attribute
+ + +

+

+ An anchor with just a name - \ No newline at end of file + -- cgit v1.2.3