Fixed text selection for quote in Internet Explorer
authorAlexander Ebert <ebert@woltlab.com>
Sat, 13 Dec 2014 13:35:43 +0000 (14:35 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 13 Dec 2014 13:35:43 +0000 (14:35 +0100)
wcfsetup/install/files/js/WCF.Message.js

index 450b50f94b29c45553a2b33bd4f02b94ada32551..19e241450fb38df90461b51026a49ca77349291b 100644 (file)
@@ -1979,18 +1979,20 @@ WCF.Message.Quote.Handler = Class.extend({
         * @return      string
         */
        _getNodeText: function(node) {
+               // work-around for IE, see http://stackoverflow.com/a/5983176
+               var $nodeFilter = function(node) {
+                       if (node.tagName === 'H3') {
+                               return NodeFilter.FILTER_REJECT;
+                       }
+                       
+                       return NodeFilter.FILTER_ACCEPT;
+               };
+               $nodeFilter.acceptNode = $nodeFilter;
+               
                var $walker = document.createTreeWalker(
                        node,
                        NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,
-                       {
-                               acceptNode: function(node) {
-                                       if (node.tagName === 'H3') {
-                                               return NodeFilter.FILTER_REJECT;
-                                       }
-                                       
-                                       return NodeFilter.FILTER_ACCEPT;
-                               }
-                       },
+                       $nodeFilter,
                        true
                );