[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    khtmltests/regression
From:       David Faure <faure () kde ! org>
Date:       2005-04-18 11:34:17
Message-ID: 20050418113417.E51CF625 () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

Add test for copying a listener from an element to an another one.
Shows that I was right in that TODO comment, we need to store the node at
the time of creating the event listener. Will merge patch from Safari which does \
that.


  M +13 -4     baseline/events/eventhandlerscope.html-dom   1.9
  M            baseline/events/eventhandlerscope.html-dump.png   1.11
  M +10 -3     tests/events/eventhandlerscope.html   1.4
  M +3 -2      tests/events/eventhandlerscope.js   1.5


--- khtmltests/regression/baseline/events/eventhandlerscope.html-dom  #1.8:1.9
@@ -238,10 +238,16 @@
                     #text "Option 3"
                 #text "          "
+              #text "   "
+              FORM action="" name="form4"
+                #text "            "
+                INPUT name="input_text_1" onblur="report(scopetest,'scopetest BUG')" \
type="text" +                #text " "
+                #text "   "
               #text "        "
             TD
               #text "          "
-              FORM action="" name="form4"
-                #text "           "
-                INPUT name="input_text_4" type="text"
+              FORM action="" name="form5"
+                #text "        "
+                INPUT name="input_text_1" type="text"
                 #text " "
                 #text "          "
@@ -284,9 +290,12 @@
         document.forms['form3'].elements[i].scopetest = 'scopetest element';
 
+      // copying a listener should still use the initial node's scope. Based on \
testcsae by Maciej Stachowiak. +      form4.input_text_1.scopetest = 'scopetest form4 \
element - BUG!'; +      form4.input_text_1.onblur = form3.input_text_1.onblur;
 
       // now we can associate some event handlers using JS. Only now, since
       // the code is resolved now.
       function scopetest_expects_window() { report( scopetest, 'scopetest window' ); \
                }
-      form4.input_text_4.onclick = scopetest_expects_window;
+      form5.input_text_1.onclick = scopetest_expects_window;
 
       // this function will be overridded when called from eventhandlerscope.js

--- khtmltests/regression/tests/events/eventhandlerscope.html  #1.3:1.4
@@ -1,3 +1,4 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!-- If you change anything in this file, make sure to check that \
events/eventhandlerscope.js is still valid -->  <html>
   <head>
@@ -191,8 +192,11 @@
             </select>
           </form>
+          <form name="form4" action="">
+            <input name="input_text_1" type="text" \
onblur="report(scopetest,'scopetest BUG')"> <!-- onblur is also set at the end, via \
JS --> +          </form>
         </td>
         <td>
-          <form name="form4" action="">
-            <input name="input_text_4" type="text"> <!-- onblur is set at the end, \
via JS --> +          <form name="form5" action="">
+            <input name="input_text_1" type="text"> <!-- onclick is set at the end, \
via JS -->  </form>
         </td>
@@ -224,9 +228,12 @@
         document.forms['form3'].elements[i].scopetest = 'scopetest element';
 
+      // copying a listener should still use the initial node's scope. Based on \
testcsae by Maciej Stachowiak. +      form4.input_text_1.scopetest = 'scopetest form4 \
element - BUG!'; +      form4.input_text_1.onblur = form3.input_text_1.onblur;
 
       // now we can associate some event handlers using JS. Only now, since
       // the code is resolved now.
       function scopetest_expects_window() { report( scopetest, 'scopetest window' ); \
                }
-      form4.input_text_4.onclick = scopetest_expects_window;
+      form5.input_text_1.onclick = scopetest_expects_window;
 
       // this function will be overridded when called from eventhandlerscope.js

--- khtmltests/regression/tests/events/eventhandlerscope.js  #1.4:1.5
@@ -14,5 +14,6 @@
 // Check that all of the expected form elements are present in the DOM
 var okforms = 0;
-for (var formno = 0; formno < part.document.forms.length; formno++) {
+var formsToCheck = 3;
+for (var formno = 0; formno < formsToCheck; formno++) {
   var form = part.document.forms[formno];
   if (form.elements.length == 10 &&
@@ -50,5 +51,5 @@
       evt.initEvent("blur",false,false);
     }
-    else if (element.getAttribute("onclick") != "" || formno == 3 /*form 3 doesn't \
use HTML attributes*/) { +    else if (element.getAttribute("onclick") != "" || \
formno >= 3 /* only forms 0,1,2 use HTML attributes*/) {  evt = \
part.document.createEvent("MouseEvents");  \
evt.initMouseEvent("click",true,true,part.document.defaultView,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic