r9687 - in helma-ng/trunk/modules: helma test/helma

[email protected] Tue, 28 Apr 2009 11:25:39 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090428092539.07B433D0D6@mia>
Author: hannes
Date: 2009-04-28 11:25:38 +0200 (Tue, 28 Apr 2009)
New Revision: 9687

Modified:
   helma-ng/trunk/modules/helma/skin.js
   helma-ng/trunk/modules/test/helma/skin_test.js
Log:
Fix bug in helma/skin where subskin filter clashes with Array.prototype.filter() method. Adapt skin test to new macro argument order.

Details at http://dev.helma.org/trac/helma/changeset/9687

Modified: helma-ng/trunk/modules/helma/skin.js
===================================================================
--- helma-ng/trunk/modules/helma/skin.js	2009-04-28 09:01:23 UTC (rev 9686)
+++ helma-ng/trunk/modules/helma/skin.js	2009-04-28 09:25:38 UTC (rev 9687)
@@ -77,14 +77,14 @@
         } else if (part.name === 'subskin')  {
             var skinName = part.getParameter('name', 0);
             currentSkin = [];
-            currentSkin.filter = part.filter;
+            currentSkin.subskinFilter = part.filter;
             subSkins[skinName] = currentSkin;
         } else {
             currentSkin[currentSkin.length] = part;
         }
     });
     // normalization: cut trailing whitespace so it's
-    // easier to tell if main skin shoule be inherited
+    // easier to tell if main skin should be inherited
     var lastPart = mainSkin[mainSkin.length - 1];
     if (typeof(lastPart) === 'string' && lastPart.trim() === '') {
         mainSkin.pop();
@@ -139,8 +139,8 @@
 
     function renderInternal(parts, context) {
         var value = [renderPart(part, context) for each (part in parts)].join('');
-        if (parts && parts.filter)
-            return evaluateFilter(value, parts.filter, context);
+        if (parts && parts.subskinFilter)
+            return evaluateFilter(value, parts.subskinFilter, context);
         return value;
     }
 

Modified: helma-ng/trunk/modules/test/helma/skin_test.js
===================================================================
--- helma-ng/trunk/modules/test/helma/skin_test.js	2009-04-28 09:01:23 UTC (rev 9686)
+++ helma-ng/trunk/modules/test/helma/skin_test.js	2009-04-28 09:25:38 UTC (rev 9687)
@@ -40,7 +40,7 @@
     assertEqual('ab', render(skin));
 
     skin = createSkin('a<% s %><% subskin sub %>b');
-    context = {s_macro: function(macro, skin) skin.renderSubskin('sub')}
+    context = {s_macro: function(macro, context, skin) skin.renderSubskin('sub')}
     assertEqual('ab', render(skin, context));
 };