aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/link_hints.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-04-29 10:41:48 +0100
committerStephen Blott2015-04-29 10:45:58 +0100
commit7917647ccad6712118b08cd86e3b4a6dda763ae3 (patch)
treec653ce663e47fe216daf9d576f0cf8e49f4493b2 /content_scripts/link_hints.coffee
parentbc5e9545398e0e74529738e690f16063ae41f8c0 (diff)
downloadvimium-7917647ccad6712118b08cd86e3b4a6dda763ae3.tar.bz2
Use innerHTML instead of contentText.
If we use contentText, then it is possible for a child and its to have exactly the same content text, in which case it is arbitrary as to which is sorted first, hence which we choose (where we should be choosing the child). Using innerHTML instead, we guess that even if the contentText lengths are the same, the innerHTML of the parent will be longer (since it contains that of the child).
Diffstat (limited to 'content_scripts/link_hints.coffee')
-rw-r--r--content_scripts/link_hints.coffee4
1 files changed, 2 insertions, 2 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index a5be6c57..3cebac4c 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -64,8 +64,8 @@ LinkHints =
# When using text filtering, we sort the elements such that we visit descendants before their ancestors.
# This allows us to exclude the text used for matching descendants from that used for matching their
# ancestors.
- textLength = (el) -> el.element.textContent?.length ? 0
- elements.sort (a,b) -> textLength(a) - textLength b
+ length = (el) -> el.element.innerHTML?.length ? 0
+ elements.sort (a,b) -> length(a) - length b
hintMarkers = (@createMarkerFor(el) for el in elements)
@getMarkerMatcher().fillInMarkers(hintMarkers)