diff options
| author | Stephen Blott | 2016-03-13 08:10:23 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-28 05:45:38 +0100 |
| commit | b7f0487d32dd50b73cf7729bbb4a900db9b786c8 (patch) | |
| tree | 29fe9d8078bd31454f2346403220ac24272b2b46 /lib | |
| parent | 6271ce2ba4e73c7506f638113660a5fb1e66e999 (diff) | |
| download | vimium-b7f0487d32dd50b73cf7729bbb4a900db9b786c8.tar.bz2 | |
Global link hints; revert b7535a604954b5873d825eb66bfecd08f1f2c99b.
Here's why:
- b7535a604954b5873d825eb66bfecd08f1f2c99b is complicated and complex (O(n^2)).
- With experience, it is not obviously better than what was there
before, and in some cases it's worse.
- b7535a604954b5873d825eb66bfecd08f1f2c99b selects way too much text in
some cases; e.g. on Google Inbox, it selects text lengths in the tens
of thousands of characters. That cannot be useful.
- With global hints, this extra cost (resulting from passing large
objects between frames) is significant and noticable.
- The simpler approach of accounting for text length when scoring
filtered hints (tweaked here: 5cbc5ad702a01a81b98f8c82edb3b6d227c2c7b5)
works better in practice.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 39e1fecd..014a1f50 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -316,25 +316,6 @@ DomUtils = else sel.focusNode - # Get the text content of an element (and its descendents), but omit the text content of previously-visited - # nodes. See #1514. - # NOTE(smblott). This is currently O(N^2) (when called on N elements). An alternative would be to mark - # each node visited, and then clear the marks when we're done. - textContent: do -> - visitedNodes = null - reset: -> visitedNodes = [] - get: (element) -> - nodes = document.createTreeWalker element, NodeFilter.SHOW_TEXT - texts = - while node = nodes.nextNode() - continue unless node.nodeType == 3 - continue if node in visitedNodes - text = node.data.trim() - continue unless 0 < text.length - visitedNodes.push node - text - texts.join " " - # Get the element in the DOM hierachy that contains `element`. # If the element is rendered in a shadow DOM via a <content> element, the <content> element will be # returned, so the shadow DOM is traversed rather than passed over. |
