Index: lps/lfc/core/LzNode.as
===================================================================
--- lps/lfc/core/LzNode.as	(revision 1742)
+++ lps/lfc/core/LzNode.as	(working copy)
@@ -90,7 +90,8 @@
 
         this.__LZapplyArgs( maskedargs , true );
 
-        if ( maskedargs.$styles ) this.__LZapplyStyleMap( maskedargs.$styles() );
+        var styleMap = this.$styles();
+        if ( styleMap ) this.__LZapplyStyleMap( styleMap );
 
         this.constructWithArgs( maskedargs );
 
@@ -172,6 +173,16 @@
 }
 
 
+//---
+// Default style map.  Will be overridden for classes that have $style
+// constraints.
+//
+// @keywords private
+//---
+LzNode.prototype.$styles = function () {
+  return null;
+}
+
 //------------------------------------------------------------------------------
 // @keywords private
 //------------------------------------------------------------------------------
Index: lps/server/src/org/openlaszlo/compiler/NodeModel.java
===================================================================
--- lps/server/src/org/openlaszlo/compiler/NodeModel.java	(revision 1742)
+++ lps/server/src/org/openlaszlo/compiler/NodeModel.java	(working copy)
@@ -1476,15 +1476,23 @@
             } catch (java.io.IOException e) {
                 throw new ChainedException(e);
             }
+            // NOTE: [2006-09-04 ptw] The $styles method _must_ create
+            // a new map each time, because the sub-class or instance
+            // may modify it.
             attrs.put("$styles",
                       new
                       Function(
                           "",
                           "",
-                          "\n#beginContent\n" +
-                          "\n#pragma 'withThis'\n" +
-                          "return " + styleMap +
-                          "\n#endContent")
+                          "\n#beginContent" +
+                          "\n#pragma 'withThis'" +
+                          "\n#pragma 'methodName=$styles'" +
+                          "\nvar map = super.$styles() || (new Object);" +
+                          "\nvar s = " + styleMap + ";" +
+                          "\nfor (var k in s) { map[k] = s[k]; };" +
+                          "\nreturn map;" +
+                          "\n#endContent" +
+                          "\n")
                       );
         }
     }
