diff options
| author | Stephen Blott | 2015-04-29 10:41:48 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-04-29 10:45:58 +0100 | 
| commit | 7917647ccad6712118b08cd86e3b4a6dda763ae3 (patch) | |
| tree | c653ce663e47fe216daf9d576f0cf8e49f4493b2 /content_scripts/link_hints.coffee | |
| parent | bc5e9545398e0e74529738e690f16063ae41f8c0 (diff) | |
| download | vimium-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.coffee | 4 | 
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) | 
