[KSS-checkins] r42287 - in kukit/kss.core/trunk/kss/core: plugins/core tests

gotcha at codespeak.net gotcha at codespeak.net
Tue Apr 24 17:37:40 CEST 2007


Author: gotcha
Date: Tue Apr 24 17:37:40 2007
New Revision: 42287

Modified:
   kukit/kss.core/trunk/kss/core/plugins/core/commands.py
   kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py
   kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py
Log:
add withKssSetup parameter to commands that insert nodes.

It is True by default.
Setting it to False will avoid the setup of KSS rules on newly inserted nodes.
This allow to improve performance when the developer knows no ajax is needed on
inserted nodes.


Modified: kukit/kss.core/trunk/kss/core/plugins/core/commands.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/plugins/core/commands.py	(original)
+++ kukit/kss.core/trunk/kss/core/plugins/core/commands.py	Tue Apr 24 17:37:40 2007
@@ -27,17 +27,19 @@
 
     # XXX the list is not full: maybe complete them?
     
-    def replaceInnerHTML(self, selector, new_value):
+    def replaceInnerHTML(self, selector, new_value, withKssSetup='True'):
         """ see interfaces.py """
         new_value = HtmlParser(new_value)().encode('ascii', 'xmlcharrefreplace')
         command = self.commands.addCommand('replaceInnerHTML', selector)
         data = command.addParam('html', new_value)
+        data = command.addParam('withKssSetup', withKssSetup)
 
-    def replaceHTML(self, selector, new_value):
+    def replaceHTML(self, selector, new_value, withKssSetup='True'):
         """ see interfaces.py """
         new_value = HtmlParser(new_value)().encode('ascii', 'xmlcharrefreplace')
         command = self.commands.addCommand('replaceHTML', selector)
         data = command.addParam('html', new_value)
+        data = command.addParam('withKssSetup', withKssSetup)
     
     def setAttribute(self, selector, name, value):
         """ see interfaces.py """
@@ -51,29 +53,33 @@
         data = command.addParam('name', name)
         data = command.addParam('value', value)
     
-    def insertHTMLAfter(self, selector, new_value):
+    def insertHTMLAfter(self, selector, new_value, withKssSetup='True'):
         """ see interfaces.py """
         new_value = HtmlParser(new_value)().encode('ascii', 'xmlcharrefreplace')
         command = self.commands.addCommand('insertHTMLAfter', selector)
         data = command.addParam('html', new_value)
+        data = command.addParam('withKssSetup', withKssSetup)
 
-    def insertHTMLAsFirstChild(self, selector, new_value):
+    def insertHTMLAsFirstChild(self, selector, new_value, withKssSetup='True'):
         """ see interfaces.py """
         new_value = HtmlParser(new_value)().encode('ascii', 'xmlcharrefreplace')
         command = self.commands.addCommand('insertHTMLAsFirstChild', selector)
         data = command.addParam('html', new_value)
+        data = command.addParam('withKssSetup', withKssSetup)
 
-    def insertHTMLAsLastChild(self, selector, new_value):
+    def insertHTMLAsLastChild(self, selector, new_value, withKssSetup='True'):
         """ see interfaces.py """
         new_value = HtmlParser(new_value)().encode('ascii', 'xmlcharrefreplace')
         command = self.commands.addCommand('insertHTMLAsLastChild', selector)
         data = command.addParam('html', new_value)
+        data = command.addParam('withKssSetup', withKssSetup)
 
-    def insertHTMLBefore(self, selector, new_value):
+    def insertHTMLBefore(self, selector, new_value, withKssSetup='True'):
         """ see interfaces.py """
         new_value = HtmlParser(new_value)().encode('ascii', 'xmlcharrefreplace')
         command = self.commands.addCommand('insertHTMLBefore', selector)
         data = command.addParam('html', new_value)
+        data = command.addParam('withKssSetup', withKssSetup)
 
     def clearChildNodes(self, selector):
         """ see interfaces.py """

Modified: kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py	(original)
+++ kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py	Tue Apr 24 17:37:40 2007
@@ -22,10 +22,10 @@
         """Return a all nodes in the parent chain which match the css
         selector"""
 
-    def replaceInnerHTML(selector, new_value):
+    def replaceInnerHTML(selector, new_value, withKssSetup='True'):
         """Replace the contents of a node (selector) with the new_value"""
 
-    def replaceHTML(selector, new_value):
+    def replaceHTML(selector, new_value, withKssSetup='True'):
         """Replace the node itself with new_value
         
         Node selection is done using the selector argument."""
@@ -36,15 +36,18 @@
     def setStyle(selector, name, value):
         """Set the style attribute of nodes specified by the selector"""
 
-    def insertHTMLAfter(selector, new_value):
+    def insertHTMLAfter(selector, new_value, withKssSetup='True'):
         """Insert some HTML after the node indicated by selector"""
 
-    def insertHTMLAsFirstChild(selector, new_value):
-        """Insert some HTML as the first childnode specified by selector"""
-
-    def insertHTMLBefore(selector, new_value):
+    def insertHTMLBefore(selector, new_value, withKssSetup='True'):
         """Insert some HTML before the node specified by selector"""
 
+    def insertHTMLAsFirstChild(selector, new_value, withKssSetup='True'):
+        """Insert some HTML as the first child of the node specified by selector"""
+
+    def insertHTMLAsLastChild(selector, new_value, withKssSetup='True'):
+        """Insert some HTML as the last child of the node specified by selector"""
+
     def clearChildNodes(selector):
         """Remove all the child nodes from the node specified by selector"""
 

Modified: kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py	(original)
+++ kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py	Tue Apr 24 17:37:40 2007
@@ -34,8 +34,9 @@
         self.assertEqual(command.getName(), 'replaceInnerHTML')
         self.assertEqual(command.getSelector(), 'div.class')
         params = command.getParams()
-        self.assertEqual(len(params), 1)
+        self.assertEqual(len(params), 2)
         self.assertEqual(params[0].getName(), 'html')
+        self.assertEqual(params[1].getName(), 'withKssSetup')
         if content2 == None:
             content2 = content
         self.assertEqual(params[0].getContent().encode('ascii', 'xmlcharrefreplace'), content2.encode('ascii', 'xmlcharrefreplace'))
@@ -108,6 +109,7 @@
 <kukit:command selector="div.class" name="replaceInnerHTML"
                selectorType="">
     <kukit:param name="html">new content</kukit:param>
+    <kukit:param name="withKssSetup">True</kukit:param>
 </kukit:command>
 '''
         self.assertCommandsEqual(result, awaited)
@@ -121,6 +123,7 @@
 <kukit:command selector="div.class" name="replaceInnerHTML"
                selectorType="">
     <kukit:param name="html">new content</kukit:param>
+    <kukit:param name="withKssSetup">True</kukit:param>
 </kukit:command>
 '''
         self.assertCommandsEqual(result, awaited)


More information about the Kukit-checkins mailing list