Author: jvloothuis
Date: Thu Nov 8 11:13:26 2007
New Revision: 48400
Modified:
kukit/kss.base/trunk/kss/base/commands.py
kukit/kss.base/trunk/kss/base/commands.txt
kukit/kss.base/trunk/kss/base/corecommands.txt
Log:
Fixed a problem with Firefox splitting text nodes at 4096 bytes. All
values are now packed into CDATA sections instead of XML escaped which
makes them a different node type.
Modified: kukit/kss.base/trunk/kss/base/commands.py
==============================================================================
--- kukit/kss.base/trunk/kss/base/commands.py (original)
+++ kukit/kss.base/trunk/kss/base/commands.py Thu Nov 8 11:13:26 2007
@@ -1,4 +1,4 @@
-from xml.sax.saxutils import quoteattr, escape
+from xml.sax.saxutils import quoteattr
from kss.base.registry import command_set_registry
from kss.base.selectors import Selector
from kss.base.coreselectors import css
@@ -12,7 +12,7 @@
kss_command_end = '</kukit:command>'
-kss_param = '<kukit:param name=%(name)s>%(value)s</kukit:param>'
+kss_param = '<kukit:param name=%(name)s><![CDATA[%(value)s]]></kukit:param>'
class KSSCommands(object):
'''Command renderer for creating KSS responses'''
@@ -41,7 +41,7 @@
action=quoteattr(action)))
for name, value in options.items():
output.append(kss_param % dict(
- name=quoteattr(name), value=escape(value)))
+ name=quoteattr(name), value=value))
output.append(kss_command_end)
output.append(kss_response_footer)
return ''.join(output)
Modified: kukit/kss.base/trunk/kss/base/commands.txt
==============================================================================
--- kukit/kss.base/trunk/kss/base/commands.txt (original)
+++ kukit/kss.base/trunk/kss/base/commands.txt Thu Nov 8 11:13:26 2007
@@ -38,6 +38,15 @@
>>> commands.render()
'...some value...some arg...'
+The response is an XML document where each parameter value is put
+within CDATA blocks.
+
+ >>> commands.render()
+ '...<![CDATA[some value]]>...'
+
+We are using CDATA because Firefox chops text nodes at 4KB blocks
+(which makes the client side handling more difficult).
+
It is also possible to get a string representation of the
commandset. This can be used in doctests like this.
Modified: kukit/kss.base/trunk/kss/base/corecommands.txt
==============================================================================
--- kukit/kss.base/trunk/kss/base/corecommands.txt (original)
+++ kukit/kss.base/trunk/kss/base/corecommands.txt Thu Nov 8 11:13:26 2007
@@ -18,7 +18,7 @@
>>> core.replaceInnerHTML(css('div'), 'some <h1>html</h1>')
>>> commands.render()
- '...replaceInnerHTML...some &lt;h1&gt;html&lt;/h1&gt;...'
+ '...replaceInnerHTML...<![CDATA[some <h1>html</h1>]]>...'
-----------------
Node modification
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins