Skip to main content

Bug Tracker

Side navigation

Ticket #2620: event-2620.patch
File event-2620.patch, 0.8 KB (added by jacob, March 29, 2008 09:19PM UTC)

don't dereference doc if it's null

Index: src/event.js
===================================================================
--- src/event.js	(revision 5143)
+++ src/event.js	(working copy)
@@ -316,8 +316,8 @@
 		// Calculate pageX/Y if missing and clientX/Y available
 		if ( event.pageX == null && event.clientX != null ) {
 			var doc = document.documentElement, body = document.body;
-			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
-			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || 0);
+			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || 0);
 		}
 			
 		// Add which for key events

Download in other formats:

Original Format