Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8439 closed bug (wontfix)

$(input element).val() returns reversed string under certain conditions

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

(Bug occurs on Firefox 3.6.14 (but not on Opera 11.01), using Google's jQuery 1.5.1.min).

Bit of an obscure one, this.

Run the code below, and type a string. The string will be echoed to the screen reversed.

Change the font-size near the end to anything other than 0, and rerun. The string will be echoed to the screen correctly.

Whu?

<html>
 <head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
  <script type="text/javascript">
   $(function()
   {
    $('#passwordInput').keydown(function(event)
    {
     $('#term_pass .display').text(  $('#passwordInput').val()   );  
    });
    $('#passwordInput').keyup(function(event)
    {
     $('#term_pass .display').text(  $('#passwordInput').val()   );  
    });
    
    $('#passwordInput').focus();
   });
  </script>
 </head>


 <body>
  Password:
  <div id="term_pass">
   <span class="display"></span>
  </div>

  <form>
   <input style="font-size: 0px;"  type="password" id="passwordInput"/>
  </form>
 </body>
</html>

Why would the font-size of an input box influence the string contained within?

Not sure whether the bug is me, jQuery or Firefox.

Change History (3)

comment:1 Changed 8 years ago by anonymous

Bugger. I didn't see the jsFiddle warning until I submitted, and now I can't edit it. Sorry.

comment:2 Changed 8 years ago by Rick Waldron

Component: unfiledattributes
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

Confirmed: http://jsfiddle.net/rwaldron/fd6xV/1/

As you can see, this is not a jQuery bug

comment:3 Changed 8 years ago by anonymous

Ah, thank you. I'll resubmit to Firefox.

Note: See TracTickets for help on using tickets.