Changing .text() modifies container's margins

Changing .text() modifies container's margins

Using the code from http://jqueryui.com/button/ and modifying it to change the text of the items clicked on, I am surprised that two of the three items' margins shrink to a minimum rect surrounding the text (the only one that maintains its margins is the input button.

So:
    1. Should I be surprised? I'm a noobly, so wouldn't be surprised that I shouldn't be...  ;)
    2. How can I maintain the margin of the containers when the text changes?
Thanks!

Bex

Ref:

  1. <!doctype html>
  2.  
  3. <html lang="en">
  4. <head>
  5.   <meta charset="utf-8" />
  6.   <title>jQuery UI Button - Default functionality</title>
  7.   <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  8.   <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  9.   <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  10.  <!-- <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css" /> -->
  11.   <script>
  12.       $(function () {
  13.           $("input[type=submit], a, button")
  14.       .button()
  15.       .click(function (event) {
  16.           event.preventDefault();
  17.           $(this).text("xxxxxxxxxxxxxx");
  18.           $(this).val("xxxxxxxxxxxxxx");
  19.       });
  20.       });
  21.   </script>
  22. </head>
  23. <body>
  24.  
  25. <button>A button element</button>
  26.  
  27. <input type="submit" value="A submit button" />
  28.  
  29. <a href="#">An anchor</a>
  30.  
  31.  
  32. </body>
  33. </html>