Index: pkg/polymer_expressions/lib/polymer_expressions.dart |
diff --git a/pkg/polymer_expressions/lib/polymer_expressions.dart b/pkg/polymer_expressions/lib/polymer_expressions.dart |
index dd7d7af922ff6993199749f82ea2cea972f62a2c..e94e3337a407c593f530dd1604220a1e90b49664 100644 |
--- a/pkg/polymer_expressions/lib/polymer_expressions.dart |
+++ b/pkg/polymer_expressions/lib/polymer_expressions.dart |
@@ -12,6 +12,7 @@ import 'package:observe/observe.dart'; |
import 'eval.dart'; |
import 'expression.dart'; |
import 'parser.dart'; |
+import 'src/globals.dart'; |
// TODO(justin): Investigate XSS protection |
Object _classAttributeConverter(v) => |
@@ -25,11 +26,19 @@ Object _styleAttributeConverter(v) => |
v; |
class PolymerExpressions extends BindingDelegate { |
+ /** The default [globals] to use for Polymer expressions. */ |
+ static const Map DEFAULT_GLOBALS = const { 'enumerate': enumerate }; |
final Map<String, Object> globals; |
+ /** |
+ * Creates a new binding delegate for Polymer expressions, with the provided |
+ * variables used as [globals]. If no globals are supplied, a copy of the |
+ * [DEFAULT_GLOBALS] will be used. |
+ */ |
PolymerExpressions({Map<String, Object> globals}) |
- : globals = (globals == null) ? new Map<String, Object>() : globals; |
+ : globals = (globals == null) ? |
+ new Map<String, Object>.from(DEFAULT_GLOBALS) : globals; |
justinfagnani
2013/09/17 21:45:05
I think I'd rather see the default globals set in
Jennifer Messerly
2013/10/08 00:55:01
yeah, I was kinda wondering that too. So far we do
|
_Binding getBinding(model, String path, name, node) { |
if (path == null) return null; |
@@ -105,5 +114,4 @@ class _Binding extends Object with ChangeNotifierMixin { |
setValueWorkaround(key, v) { |
if (key == _VALUE) value = v; |
} |
- |
} |