aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dom_utils.coffee
AgeCommit message (Collapse)Author
2016-02-18Wait-for-enter: for filtered hints.Stephen Blott
This affects filtered hints only. If a hint is triggered because the user typed the link text, then: - highlight the link - but wait until the user types `Enter` before activating the link.
2016-01-30Rework unhovering to occur automatically for all simulated hoversmrmr1993
2016-01-30Emit mouseout when clicking a new element link hintsmrmr1993
2016-01-26Disable position-at-end in text areas.Stephen Blott
When we `simulateSelect` an input and the selection is at the start, we move it to the end. This works well for single-line inputs. However, the UX is *bad* for multiline inputs (such as text areas), and doubly so if the end of the input happens to be out of the viewport. This commit simply disables the repositioning of the selection within text areas.
2015-09-07Traverse shadow DOMs when looking for scrollable elementsmrmr1993
2015-08-28a better way to detect document typesgdh1995
On a XML view page, createElement will create an "Element" object Otherwise, createElement('div') will get an object : HTMLDivElement >> HTMLElement >> Element
2015-08-28fix a new typogdh1995
oh my god
2015-08-28remove `.bind` imported in da8653f because dom tests fail if bind existsgdh1995
2015-08-28fix a typo in PR #1798gdh1995
2015-08-28clean codegdh1995
2015-08-26Use createElementNS for XML documents and remove XML specific codepathsmrmr1993
This implements @gdh1995's idea from #1796.
2015-07-20Treat links with fixed position children like absolutely positionedmrmr1993
This fixes #1770.
2015-06-10Move finding the element at a selection's focus to a library functionmrmr1993
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