Fix for some weird range issues in IE 11
authorAlexander Ebert <ebert@woltlab.com>
Tue, 24 Feb 2015 08:39:37 +0000 (09:39 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 24 Feb 2015 08:39:37 +0000 (09:39 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index 06df3569fd488aaec4aeef281426b5cb2a0c7f28..6a136402c27d6618e3c92c7ab67a87a9dc7d8216 100644 (file)
@@ -157,7 +157,7 @@ RedactorPlugins.wmonkeypatch = function() {
                                                        }
                                                }
                                                
-                                               while ($current !== null && $current !== this.$editor[0]) {
+                                               while ($current && $current !== this.$editor[0]) {
                                                        if ($current.nodeType === Node.ELEMENT_NODE) {
                                                                if ($current.tagName === 'BLOCKQUOTE' || ($current.tagName === 'DIV' && /\bcodeBox\b/.test($current.className))) {
                                                                        var $offset = $($current).offset();
index 12db841f99a429592cf2b34420e066b955d7511e..6fc1eb2b21311d44409eafbc878509e4e3e4f6df 100644 (file)
@@ -751,7 +751,7 @@ RedactorPlugins.wutil = function() {
                        
                        if (getSelection().getRangeAt(0).collapsed) {
                                var $startContainer = getSelection().getRangeAt(0).startContainer;
-                               if ($startContainer.nodeType === Node.TEXT_NODE && $startContainer.textContent === '\u200b' && $startContainer.parentElement.tagName === 'P' && $startContainer.parentElement.parentElement === this.$editor[0]) {
+                               if ($startContainer.nodeType === Node.TEXT_NODE && $startContainer.textContent === '\u200b' && $startContainer.parentElement && $startContainer.parentElement.tagName === 'P' && $startContainer.parentElement.parentElement === this.$editor[0]) {
                                        // caret position is fine
                                        return;
                                }