From 944be5fa64c935940a33a3d2494833bfb17f3358 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 28 Jan 2017 19:22:28 -0800 Subject: [PATCH] adding more polyfill goodness for firefox --- ext/bg/js/gecko.js | 2 -- ext/fg/frame.html | 1 + ext/fg/js/gecko.js | 12 ++++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 ext/fg/js/gecko.js diff --git a/ext/bg/js/gecko.js b/ext/bg/js/gecko.js index a39610ff..f055e163 100644 --- a/ext/bg/js/gecko.js +++ b/ext/bg/js/gecko.js @@ -1,5 +1,3 @@ -console.log('blah'); - // // Gecko does not currently support chrome.storage.sync, use storage.local instead // https://bugzilla.mozilla.org/show_bug.cgi?id=1220494 diff --git a/ext/fg/frame.html b/ext/fg/frame.html index 8246787b..b098a42d 100644 --- a/ext/fg/frame.html +++ b/ext/fg/frame.html @@ -13,6 +13,7 @@
+ 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; + }; +}