Ticket #5085 (closed bug: fixed)

Opened 4 years ago

Last modified 19 months ago

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:
Blocking: Blocked by:

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.


Change History

comment:1 Changed 4 years ago by kbwood

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r3721.

comment:2 Changed 19 months ago by scott.gonzalez

  • Milestone TBD deleted

Milestone TBD deleted

Note: See TracTickets for help on using tickets.