From b2c779faeaf19598a404437843b88c7a6e8c7118 Mon Sep 17 00:00:00 2001 From: Irvin Zhan Date: Wed, 19 Aug 2015 00:39:24 -0700 Subject: [PATCH] speedup normalizeIgnoredCharacters when no chars are ignored --- src/modules/rangy-textrange.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/rangy-textrange.js b/src/modules/rangy-textrange.js index f166d570..ea59886b 100644 --- a/src/modules/rangy-textrange.js +++ b/src/modules/rangy-textrange.js @@ -188,6 +188,9 @@ rangy.createModule("TextRange", ["WrappedSelection"], function(api, module) { // Check if character is ignored var ignoredChars = ignoredCharacters || ""; + if (ignoredCharacters === "") + return ignoredCharacters + // Normalize ignored characters into a string consisting of characters in ascending order of character code var ignoredCharsArray = (typeof ignoredChars == "string") ? ignoredChars.split("") : ignoredChars; ignoredCharsArray.sort(function(char1, char2) {