diff options
| author | int3 | 2010-06-03 00:22:57 +0800 |
|---|---|---|
| committer | int3 | 2010-06-03 00:23:50 +0800 |
| commit | 626d7be7d10884dd401996ef7b88049b420f42f9 (patch) | |
| tree | 76957b8000bf20375c36ff10c58da5cedb9313c4 /linkHints.js | |
| parent | 8893e55daec12693197e4550a75f28885f47760f (diff) | |
| download | vimium-626d7be7d10884dd401996ef7b88049b420f42f9.tar.bz2 | |
Use Element.children instead of Element.childNodes
Possibly faster and definitely cleaner
Diffstat (limited to 'linkHints.js')
| -rw-r--r-- | linkHints.js | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/linkHints.js b/linkHints.js index b0a8413d..5348b19c 100644 --- a/linkHints.js +++ b/linkHints.js @@ -95,20 +95,14 @@ function getVisibleClickableElements() { // If the link has zero dimensions, it may be wrapping visible // but floated elements. Check for this. if (clientRect && (clientRect.width == 0 || clientRect.height == 0)) { - for (var j = 0; j < element.childNodes.length; j++) { - - // check that the node is an element node - if (element.childNodes[j].nodeType != 1) // nodeType 1: ELEMENT_NODE - continue; - - if (window.getComputedStyle(element.childNodes[j], null).getPropertyValue('float') != 'none') { - var childClientRect = element.childNodes[j].getClientRects()[0]; - if (isVisible(element.childNodes[j], childClientRect)) { - visibleElements.push({element: element.childNodes[j], rect: childClientRect}); + for (var j = 0; j < element.children.length; j++) { + if (window.getComputedStyle(element.children[j], null).getPropertyValue('float') != 'none') { + var childClientRect = element.children[j].getClientRects()[0]; + if (isVisible(element.children[j], childClientRect)) { + visibleElements.push({element: element.children[j], rect: childClientRect}); break; } } - } } } |
