This commit makes Tridactyl aware of elements made interactive through
JavaScript and lets Tridactyl put hints on them.
Something possibly dangerous is done here: exporting a function to the
page's context. While it is believed that the current implementation is
secure and that pages can't discover whether the function has been
exported or not, this might change due to new standards being adopted by
firefox. One of these standards is the Custom Elements api:
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements
It will be necessary to check how Tridactyl behaves once this API has
landed. The status of this API seems to be tracked here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1406825
Previously was a case-sensitive check against an uppercase name. This
works for HTML.
XHTML will be whatever the source document is, which could be upper or
lower. Firefox will render either one the same, but only uppercase will
be deemed editable by Tridactyl. Fix this by doing a case-insensitive
comparision.
Tag casing is described in:
https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName
Thanks Koushien for working this one out!
Problem: Hints aren't displayed for certain elements. This was because
the isVisible function didn't pay attention to the element's 'display'
attribute when deciding whether an element is visible according to its
height/width.
Solution: Add two functions to help decide whether the height and width
attribute of an element matter.
Note: The two functions do not do anything if an element's 'display'
attribute is set to either 'initial' or 'inherit' because taking these
into account seems complicated.
Fixes issue https://github.com/cmcaine/tridactyl/issues/127 .
The DOM.getElemsBySelector function makes it a bit less verbose to
construct an array of filtered elements matching a selector.
Also, this function is expanded to take multiple filters, applied
sequentially.
Can focus the nth input from the start or end of a page.
Also has some special modes:
-l: last focussed input
-p: first password input
-b: the largest input by area
exmode.parser now converts strings to the types given in excmd
signatures.
Messaging now works in both directions (but I haven't made excmds.ts use
the new system yet. Exercise for the reader (see keydown_* state() for a
simple example)).
keys are now being suppressed, but in a pretty stupid way.
I got fed up of not having proper itertools, or str conversions, so I
wrote some. Others have written them in JS, but they were fun to make.
Only the ones I'm using are tested.