From 944be5fa64c935940a33a3d2494833bfb17f3358 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 28 Jan 2017 19:22:28 -0800 Subject: adding more polyfill goodness for firefox --- ext/fg/js/gecko.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ext/fg/js/gecko.js (limited to 'ext/fg/js') 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; + }; +} -- cgit v1.2.3