Bug 11561 - Element is incorrectly rendered when is created, removed and created again using DOM methods
Summary: Element is incorrectly rendered when is created, removed and created again us...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Macintosh Intel OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-10 03:41 PST by Miroslav Juhos
Modified: 2006-11-13 02:18 PST (History)
2 users (show)

See Also:


Attachments
Testcase (1.00 KB, text/html)
2006-11-10 03:43 PST, Miroslav Juhos
no flags Details
Screenshot - incorrectly rendered DIV element (7.50 KB, image/jpeg)
2006-11-10 03:44 PST, Miroslav Juhos
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Juhos 2006-11-10 03:41:33 PST
Overview Description: 
Element is incorrectly rendered when is created, removed and created again using DOM methods

Steps to Reproduce: 
1) Open testcase
2) Click into document by right mouse button
3) Move mouse about 50 px right and press right mouse button again

Actual Results: 
DIV element isn't correctly rendered (text in element isn't visible).

Expected Results: 
DIV element will be correctly rendered.

Build Date & Platform: 
    Build 2006-11-10 on Mac OS 10.5.

Test case:
<html>
  <head>
    <style>
      #menu {
        background-color:blue;
        position:absolute;
        width:200px;
      }
    </style>
    <script>
      var k_e;

      function dsp() {
        var k_contextMenu = document.getElementById("menu");
        if (!k_contextMenu) {
          k_contextMenu = document.createElement('div');
          k_contextMenu.id = 'menu';
          for (var i =1; i < 10; i++) {
            k_contextMenu.innerHTML += '<div>item ' + i + '</div>';
          }
          document.body.appendChild(k_contextMenu);
        }
        k_contextMenu.style.left = k_e.clientX + 'px'
        k_contextMenu.style.top = k_e.clientY + 'px';
      }
      function removeMenu() {
        var k_contextMenu = document.getElementById("menu");
        if (k_contextMenu) {
          var k_p = k_contextMenu.parentNode;
          k_p.removeChild(k_contextMenu);
        }
      }

      function showMenu() {
        removeMenu();
        k_e = event;
        dsp();
      }
    </script>
  </head>
  <body oncontextmenu="showMenu();return false;" onmousedown="removeMenu()">
  </body>
</html>

Workaround:
Replace calling of function dsp() by setTimeout('dsp();',0)
Comment 1 Miroslav Juhos 2006-11-10 03:43:05 PST
Created attachment 11457 [details]
Testcase
Comment 2 Miroslav Juhos 2006-11-10 03:44:11 PST
Created attachment 11458 [details]
Screenshot - incorrectly rendered DIV element
Comment 3 mitz 2006-11-10 04:38:49 PST
I am unable  to reproduce with locally built r17702 on Tiger.
Comment 4 Alexey Proskuryakov 2006-11-11 03:18:46 PST
Please file any issues you find when using Leopard via <http://bugreport.apple.com>.
Comment 5 Miroslav Juhos 2006-11-13 02:18:47 PST
Reported as Bug ID# 4833454 via http://bugreport.apple.com.