From 87d74d1e86092786807ae852c53172d3c920bbc0 Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Fri, 8 Apr 2016 03:04:15 -0400 Subject: [PATCH 1/4] Do not create range with default document. --- src/modules/rangy-textrange.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/rangy-textrange.js b/src/modules/rangy-textrange.js index f166d570..ec7fc097 100644 --- a/src/modules/rangy-textrange.js +++ b/src/modules/rangy-textrange.js @@ -1776,7 +1776,7 @@ rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) { // Create a range representing the search scope if none was provided var searchScopeRange = findOptions.withinRange; if (!searchScopeRange) { - searchScopeRange = api.createRange(); + searchScopeRange = api.createRange(this.getDocument()); searchScopeRange.selectNodeContents(this.getDocument()); } @@ -1996,4 +1996,4 @@ rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) { ) }; }); -/* build:modularizeEnd */ \ No newline at end of file +/* build:modularizeEnd */ From 9fd2ecec0418bae0f23d11274f4ae7794dfab5ae Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Sun, 10 Apr 2016 21:08:33 -0400 Subject: [PATCH 2/4] Fix released code. --- lib/rangy-textrange.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rangy-textrange.js b/lib/rangy-textrange.js index 6e380a12..459da5c5 100644 --- a/lib/rangy-textrange.js +++ b/lib/rangy-textrange.js @@ -1710,7 +1710,7 @@ // Create a range representing the search scope if none was provided var searchScopeRange = findOptions.withinRange; if (!searchScopeRange) { - searchScopeRange = api.createRange(); + searchScopeRange = api.createRange(this.getDocument()); searchScopeRange.selectNodeContents(this.getDocument()); } @@ -1927,4 +1927,4 @@ }); return rangy; -}, this); \ No newline at end of file +}, this); From 3b0fe66e1ddafea44d42fcac56ca0686f1239352 Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Fri, 15 Apr 2016 16:11:58 -0300 Subject: [PATCH 3/4] Do not spoil selection on load. --- lib/rangy-textrange.js | 4 ++++ src/modules/rangy-textrange.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib/rangy-textrange.js b/lib/rangy-textrange.js index 459da5c5..7f7f4f30 100644 --- a/lib/rangy-textrange.js +++ b/lib/rangy-textrange.js @@ -101,6 +101,9 @@ var trailingSpaceBeforeBlockCollapses = false; var trailingSpaceBeforeLineBreakInPreLineCollapses = true; + // This test code runs at load time, but generates side effects + // on the selection, which is bad. Hence, we disable it. + /* (function() { var el = dom.createTestElement(document, "

1

", true); var p = el.firstChild; @@ -122,6 +125,7 @@ dom.removeNode(el); sel.removeAllRanges(); })(); + */ /*----------------------------------------------------------------------------------------------------------------*/ diff --git a/src/modules/rangy-textrange.js b/src/modules/rangy-textrange.js index ec7fc097..a292ffab 100644 --- a/src/modules/rangy-textrange.js +++ b/src/modules/rangy-textrange.js @@ -91,7 +91,12 @@ rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) { var trailingSpaceBeforeBlockCollapses = false; var trailingSpaceBeforeLineBreakInPreLineCollapses = true; + // This test code runs at load time, but generates side effects + // on the selection, which is bad. Hence, we disable it. + /* (function() { + // This test code runs at load time, but generates side effects + // on the selection, which is bad. Hence, we disable it. var el = dom.createTestElement(document, "

1

", true); var p = el.firstChild; var sel = api.getSelection(); @@ -112,6 +117,7 @@ rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) { dom.removeNode(el); sel.removeAllRanges(); })(); + */ /*----------------------------------------------------------------------------------------------------------------*/ From 50d64b3190b8b6771cc6a45cb316d2e4cad6954e Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Fri, 16 Jun 2017 14:46:47 -0300 Subject: [PATCH 4/4] Do not ignore invisible text. --- lib/rangy-textrange.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/rangy-textrange.js b/lib/rangy-textrange.js index 7f7f4f30..6409bb35 100644 --- a/lib/rangy-textrange.js +++ b/lib/rangy-textrange.js @@ -6,7 +6,7 @@ * * - Ability to move range boundaries by character or word offsets * - Customizable word tokenizer - * - Ignores text nodes inside