Search and Top Navigation
#5085 closed bug (fixed)
Opened January 21, 2010 03:03PM UTC
Closed January 22, 2010 10:10AM UTC
Last modified October 11, 2012 09:15PM UTC
Datepicker: bug in findPos for RTL languages
| Reported by: | pservit | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | ui.datepicker | Version: | 1.8b1 |
| Keywords: | datepicker rtl arabic findPos | Cc: | |
| Blocked by: | Blocking: |
Description
When using datepicker with hidden input field and rtl language (for example Arabic) clicking on calendar icon fails with error "this[0].ownerDocument is null"
Here is patch:
--- jquery.ui.datepicker.js.orig 2010-01-20 16:04:26.000000000 +0200
+++ jquery.ui.datepicker.js 2010-01-21 16:56:21.000000000 +0200
@@ -730,11 +730,20 @@
/* Find an object's position on the screen. */
_findPos: function(obj) {
- while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
- obj = obj.nextSibling;
- }
- var position = $(obj).offset();
- return [position.left, position.top];
+ var inst = $.datepicker._getInst(obj);
+ var isRTL = this._get(inst, 'isRTL');
+
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
+ if( isRTL ) {
+ obj = obj.previousSibling;
+ } else {
+ obj = obj.nextSibling;
+ }
+ }
+
+ var position = $(obj).offset();
+
+ return [position.left, position.top];
},
/* Hide the date picker from view.
Fixed in r3721.