diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-01-28 19:22:28 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-01-28 19:22:28 -0800 |
commit | 944be5fa64c935940a33a3d2494833bfb17f3358 (patch) | |
tree | 42d5e26dbc7814ad8e2fb5af46abe4a6500b5959 /ext/fg/js/gecko.js | |
parent | 491480c4098df2ccc0258dc6b225bb72e8bdad08 (diff) |
adding more polyfill goodness for firefox
Diffstat (limited to 'ext/fg/js/gecko.js')
-rw-r--r-- | ext/fg/js/gecko.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/fg/js/gecko.js b/ext/fg/js/gecko.js new file mode 100644 index 00000000..21671749 --- /dev/null +++ b/ext/fg/js/gecko.js @@ -0,0 +1,12 @@ +if (!document.caretRangeFromPoint){ + document.caretRangeFromPoint = function polyfillcaretRangeFromPoint(x,y){ + let range = document.createRange(); + let position = document.caretPositionFromPoint(x,y); + if (!position) { + return null; + } + range.setStart(position.offsetNode, position.offset); + range.setEnd(position.offsetNode, position.offset); + return range; + }; +} |