Wicket
  1. Wicket
  2. WICKET-1960

AutoCompleteTextField - gives a type mismatch error on IE - version wicket-1.4-rc1

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4-RC1
    • Fix Version/s: 1.3.7, 1.4-RC4
    • Component/s: wicket-extensions
    • Labels:
      None

      Description

      wicket-autocomplete.js
      function function showAutoComplete()
      line 291 container.style.zIndex=(!isNaN(Number(index))?Number(index)+1:index);

      looks like IE doesn't like big i in zIndex, IE seem to be be happy with zindex

      not sure if that's the correct way to resolve the issue.

        Activity

        Hide
        Per Cederberg added a comment -

        Great, thanks!

        Show
        Per Cederberg added a comment - Great, thanks!
        Hide
        Per Cederberg added a comment -

        This is also an issue in the 1.3.x release series.

        I agree with Steen Elvstrøm. We've patched our local copy like this instead:

        if (!isNaN(new Number(index)))

        { container.style.zIndex=(new Number(index)+1); }

        Wicket doesn't need to mess with the z-index unless the offset parent z-index isn't numeric. Should probably be available in some kind of utility function.

        Show
        Per Cederberg added a comment - This is also an issue in the 1.3.x release series. I agree with Steen Elvstrøm. We've patched our local copy like this instead: if (!isNaN(new Number(index))) { container.style.zIndex=(new Number(index)+1); } Wicket doesn't need to mess with the z-index unless the offset parent z-index isn't numeric. Should probably be available in some kind of utility function.
        Hide
        Robert Starzer added a comment -

        same problem with IE 8 resulting in an javascript error

        "zIndex" is OK, but "Number(index)!=Number.NaN" is not right

        what's wrong with "container.style.zIndex=(!isNaN(Number(index))?Number(index)+1:index)"?

        thanks

        Show
        Robert Starzer added a comment - same problem with IE 8 resulting in an javascript error "zIndex" is OK, but "Number(index)!=Number.NaN" is not right what's wrong with "container.style.zIndex=(!isNaN(Number(index))?Number(index)+1:index)"? thanks
        Hide
        Steen Elvstrøm added a comment -

        What happens when you change

        container.style.zIndex=(!isNaN(Number(index))?Number(index)+1:index);
        to
        container.style.zindex=(!isNaN(Number(index))?Number(index)+1:index);

        is that you define a new member, called 'zindex', on the style object and hence won't get the type mismatch error.

        I think the correct solution would be something like this:

        container.style.zIndex = isNaN(index) ? 20 : index;

        assuming the z-index should be the same as the parent z-index. If the parent index is NaN a random number >1
        should be assigned.

        Show
        Steen Elvstrøm added a comment - What happens when you change container.style.zIndex=(!isNaN(Number(index))?Number(index)+1:index); to container.style.zindex=(!isNaN(Number(index))?Number(index)+1:index); is that you define a new member, called 'zindex', on the style object and hence won't get the type mismatch error. I think the correct solution would be something like this: container.style.zIndex = isNaN(index) ? 20 : index; assuming the z-index should be the same as the parent z-index. If the parent index is NaN a random number >1 should be assigned.
        Hide
        Dipu C Seminlal added a comment -

        that's exactly the reason why I say reverting back to
        container.style.zIndex=(Number(index)!=Number.NaN?Number(index)+1:index);
        on the trunk is not quite right

        if index = 'auto' (or any non number )
        the expression Number(index)!=Number.NaN?Number(index)+1:index
        will result in Number(index)+1

        if index = 100 (a number )
        then also expression Number(index)!=Number.NaN?Number(index)+1:index
        will result in Number(index)+1

        and I can't think of a condition in which it will result in index and that looks wrong to me

        Regards
        Dipu

        Show
        Dipu C Seminlal added a comment - that's exactly the reason why I say reverting back to container.style.zIndex=(Number(index)!=Number.NaN?Number(index)+1:index); on the trunk is not quite right if index = 'auto' (or any non number ) the expression Number(index)!=Number.NaN?Number(index)+1:index will result in Number(index)+1 if index = 100 (a number ) then also expression Number(index)!=Number.NaN?Number(index)+1:index will result in Number(index)+1 and I can't think of a condition in which it will result in index and that looks wrong to me Regards Dipu
        Hide
        Martin Benda added a comment -

        Mathematically, the NaN (Not a Number) is unequal to all other numbers, +-Inf and itself because it just has no concrete value... The isNaN function is the correct way to test whether a value is NaN or not.

        So the expression
        Number(index)!=Number.NaN?Number(index)+1:index
        is in fact just
        Number(index)+1

        Regards,
        Bendis

        Show
        Martin Benda added a comment - Mathematically, the NaN (Not a Number) is unequal to all other numbers, +-Inf and itself because it just has no concrete value... The isNaN function is the correct way to test whether a value is NaN or not. So the expression Number(index)!=Number.NaN?Number(index)+1:index is in fact just Number(index)+1 Regards, Bendis
        Hide
        Dipu C Seminlal added a comment -

        In the current trunk, it's reverted back to container.style.zIndex=(Number(index)!=Number.NaN?Number(index)+1:index); and it works,
        but its working because some thing else is broken

        when the value of index ='auto';
        the expression (Number(index)!=Number.NaN?Number(index)+1:index); return NaN,
        this looks wrong to me it should be returning 'auto'

        for example if you run the following line in javascript console in firebug you will get NaN
        var index ='auto';(Number(index)!=Number.NaN?Number(index)+1:index)

        if you run Number(index) it return NaN

        but Number(index)!=Number.NaN yields true (looks wrong to me)

        Show
        Dipu C Seminlal added a comment - In the current trunk, it's reverted back to container.style.zIndex=(Number(index)!=Number.NaN?Number(index)+1:index); and it works, but its working because some thing else is broken when the value of index ='auto'; the expression (Number(index)!=Number.NaN?Number(index)+1:index); return NaN, this looks wrong to me it should be returning 'auto' for example if you run the following line in javascript console in firebug you will get NaN var index ='auto';(Number(index)!=Number.NaN?Number(index)+1:index) if you run Number(index) it return NaN but Number(index)!=Number.NaN yields true (looks wrong to me)
        Hide
        Jeremy Thomerson added a comment - - edited

        I'm pretty sure this was already fixed. I just ran into the same yesterday. Upgraded from rc1 to snapshot and it's working. Just commenting on it so that whoever goes to fix it doesn't spin their wheels trying to reproduce if it's already working.

        Show
        Jeremy Thomerson added a comment - - edited I'm pretty sure this was already fixed. I just ran into the same yesterday. Upgraded from rc1 to snapshot and it's working. Just commenting on it so that whoever goes to fix it doesn't spin their wheels trying to reproduce if it's already working.
        Hide
        Dipu C Seminlal added a comment -

        patch with the mentioned fix

        Show
        Dipu C Seminlal added a comment - patch with the mentioned fix

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Dipu C Seminlal
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development