aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dom_utils.coffee
AgeCommit message (Collapse)Author
2015-04-28Recognise inline child elements of height=0 elements caused by font-sizemrmr1993
If an element with style="display: inline; font-size: 0px;" surrounds another element with style="display: inline; font-size: apx;", where a is non-zero, then the inner element and its contents will be visible. However, the outer element will register height=0 in its clientRects, which previously caused us to reject these elements. This changes the behaviour to handle this case correctly.
2015-04-28Make DomUtils.getVisibleClientRects default to expected behaviourmrmr1993
This requires passing of an extra truthy argument in order to access the (generally) unexpected behaviour of sometimes returning the rects of child elements. All locations in the code that *actually* wanted this behaviour have been updated to continue using it. Also add a comment about the unexpected behaviour in the function description.
2015-04-28Remove redundant testmrmr1993
Elements with css `display: none;` never have client rects.
2015-03-17Activate vomnibar in window.top; more clean up.Stephen Blott
2015-03-06Merge branch 'fix-focus-html5-inputs'Stephen Blott
2015-03-06Cosmetic changes (following #1490).Stephen Blott
Mainly fix the indentation on comments. Also tweak wording a bid.
2015-03-03Note relevant PR number for link-hint-text change.Stephen Blott
2015-03-03Do not include duplicated texts in link hints.Stephen Blott
This only effects link hints with "Use the link's name and numbers for link-hint filtering" enabled. We have been matching the *entire text content* of each link-hint element. With two (or more) hints, and with one of the elements a descendent of the other, we have been using the entire text content of the outer node (which includes the text content of the inner node). This leads to odd situations where the inner element cannot be selected just by typing its text, because its text is a substring of the outer element's text. For example, on Google calendar, the "Today" button shows up as two hints, one inside the other. Typing "today" never disambiguates the hint. You always have to hit enter. There's another nasty example on feedly, where an outer container is clickable, but its text contains all of the (many) texts of the (many) contained links. So the hint always has to be selected manually. Here, when generating the text for an element, we exclude the texts from any descendent node which has already been considered.
2015-02-19Only send cursor to end when selection has the cursor at the startmrmr1993
This restores behaviour to how it was at commit 7cedc5d2481f61f4b0d1cbf99fbd203bb5c68b54.
2015-02-19Make DomUtils.isSelected behave correctly for all editable elementsmrmr1993
2015-02-19Stop trying to place the cursor at the end of an input on focusmrmr1993
2015-02-18Remove redundant check, make isSelected's behaviour match its contractmrmr1993
2015-02-17Guard against input elements which don't support selectionStart/Endmrmr1993
These elements throw an error on access, meaning that we can't do an existence check.
2015-02-06Visual/edit modes: code cleanup.Stephen Blott
- convert getCaretCoordinates from JS to CS - handle x axis in scrollIntoView - better comments throughout.
2015-01-28Visual/edit modes: fix some movements...Stephen Blott
Also, change how vim's "w" is implemented. Also some code-review/cleanup. Better dd and yy for gmail.
2015-01-23Visual/edit modes: more (and better) commands.Stephen Blott
2015-01-23Visual/edit modes: develop edit mode.Stephen Blott
- implement "i", "a". - fix "w" for edit mode. - try out "e" for enter edit mode. - initial implementation "o", "O" - Suppress backspace and delete. - Scroll in text areas.
2015-01-20Add contentEditable as criterion for isSelectable.Stephen Blott
This allows us to select contentEditable elements in the same way as we can select other inputs. Fixes #1437.
2015-01-20Minor refactoring of isSelected().Stephen Blott
There's no point in focusing element if it's already active. Also, we leave the caret in place, not just a range selection. isSelected makes the wrong decision if the user has placed the caret at the start of element. We cannot distinguish that case from the user having made no selection. Nevertheless, this is substantially better than the existing UX, which *always* moves the caret to the end.
2015-01-18Move isSelected test to before possible blur/click.Stephen Blott
2015-01-18Merge branch 'master' into fix-simulate-selectStephen Blott
2015-01-18Do not change selection if selection exists.Stephen Blott
Fixes #1430.
2015-01-18Modes; fix simulateSelect for PostFindMode.Stephen Blott
2015-01-18Merge pull request #1413 from smblott-github/modesStephen Blott
A modal-browsing framework
2015-01-18Modes; pre-merge clean up.Stephen Blott
2015-01-12Fix race condition on the options page (better).Stephen Blott
Uses document.readyState for all onDOMContentLoaded dependent functions. This should fix the same race condition as #1426 for all cases.
2015-01-12Fix race condition on the options page.Stephen Blott
Fixes #1426.
2015-01-10Modes; better printable detection, move to keyboard_utils.Stephen Blott
2015-01-10Modes; reinstate key blockers:Stephen Blott
- when the selection is contentEditable - in PostFindMode Restricted to printable characters.
2015-01-10Modes; instrument for debugging...Stephen Blott
- Set Mode.debug to true to see mode activation/deactivation on the console. - Use Mode.log() to see a list of currently-active modes. - Use handlerStack.debugOn() to enable debugging of the handler stack.
2015-01-08Modes; incorporate small changes from #1413.Stephen Blott
Slightly more significant: Move several utilities to dome_utils.
2015-01-06Modes; when exiting on Escape, also grab keyup event.Stephen Blott
Also fix post insert.
2015-01-04Modes; various improvements.Stephen Blott
- Add StateMode. - PasskeysMode is a StateMode. - BadgeUpdateMode is a StateMode. - Improve badge handling. - Add push method to Mode. - Document how modes work. - Cache badge on background page to reduce the number of updates. - Remove badge restriction on document.body?.tagName.toLowerCase() == "frameset". - Add ExitOnEscape mode, use it for ConstrainedMode and FindMode. - Move PostFindMode to its own file.
2014-12-30Merge branch 'smblott-link-hints-overlap' into post-1.46Stephen Blott
2014-12-22Correct a typo, add some tests for consistencymrmr1993
2014-12-22Support small <area>s with link hintsmrmr1993
This is primarily to deal with our calculated rects being too small for the `<area shape="poly">` on http://www.mapsofindia.com/worldmap/clickable-world-map.html
2014-12-18Use Rect.copy instead of literal member by member copy of a rectmrmr1993
2014-12-18Make some minor changes/tweaks to rect handling in dom_utilsmrmr1993
2014-12-18Move rect functions to their own filemrmr1993
2014-12-18Remove overlapping rects from link hintsmrmr1993
2014-12-17Unify two loops into onemrmr1993
2014-12-17Stop ignoring clickable opacity: none; elementsmrmr1993
Some websites (notably Facebook) use `opacity: none;` to show an image in the place of a less-customisable element (eg. an `<input type="file" />`). To not show link hints for such transparent elements is confusing and often the wrong thing to do.
2014-12-17Don't show link hints for offscreen image mapsmrmr1993
2014-12-17Try to make image map rectangles work bettermrmr1993
2014-12-17Combine rectangle calculation and clickable element detectionmrmr1993
2014-12-17Inline DomUtils.getClickableElementsmrmr1993
2014-12-17Use element.readOnly instead of getAttribute "readonly"mrmr1993
2014-12-17Treat area elements as being at the point of their img elementmrmr1993
2014-12-17Use the DOM rather than XPath to detect clickable elementsmrmr1993
2014-12-17Merge branch 'master' into post-1.46Stephen Blott