[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kupu-checkins
Subject:    [kupu-checkins] r44500 - kupu/trunk/kupu/common
From:       duncan () codespeak ! net
Date:       2007-06-25 9:28:02
Message-ID: 20070625092802.9509280EE () code0 ! codespeak ! net
[Download RAW message or body]

Author: duncan
Date: Mon Jun 25 11:28:02 2007
New Revision: 44500

Modified:
   kupu/trunk/kupu/common/kupuhelpers.js
Log:
Applied patch plone ticket #6088: Range.intersectsNode declared obsolete

Modified: kupu/trunk/kupu/common/kupuhelpers.js
==============================================================================
--- kupu/trunk/kupu/common/kupuhelpers.js	(original)
+++ kupu/trunk/kupu/common/kupuhelpers.js	Mon Jun 25 11:28:02 2007
@@ -977,6 +977,20 @@
         selection.addRange(range);
     };
 
+    //sample kindly snipped from Mozilla's wiki
+    if( !Range.prototype.intersectsNode ){
+        Range.prototype.intersectsNode = function(node) {
+            var nodeRange = node.ownerDocument.createRange();
+            try {
+                nodeRange.selectNode(node);
+            } catch (e) {
+                nodeRange.selectNodeContents(node);
+            };
+
+            return this.compareBoundaryPoints(Range.END_TO_START, nodeRange) == -1 &&
+                this.compareBoundaryPoints(Range.START_TO_END, nodeRange) == 1;
+        };
+    };
     this.intersectsNode = function(node) {
         for(var i = 0; i < this.selection.rangeCount; i++ ) {
            if( this.selection.getRangeAt(i).intersectsNode(node) ) {

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic