From deaff54cec1973761f3b34a1517c83c54e7e2568 Mon Sep 17 00:00:00 2001 From: Jim Cowart Date: Mon, 23 May 2011 11:23:22 -0400 Subject: [PATCH] Checking to see if namespace is undefined before trying to slice on it. --- .gitignore | 1 + knockout.namespaces.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/knockout.namespaces.js b/knockout.namespaces.js index a0140a1..ccce61a 100644 --- a/knockout.namespaces.js +++ b/knockout.namespaces.js @@ -55,7 +55,7 @@ // Non-namespaced KO uses group 6, but we add 2 groups for optional namespaces after data-bind var dataBindAttributeValue = arguments[8]; // We need to detect whether or not we're binding to a namespace so we know whether to inject the 'applyBindingsToNextSiblingScript' - var namespace = arguments[6].slice(1); + var namespace = arguments[6] ? arguments[6].slice(1) : ''; // Only bind if we're binding to the global namespace or to the current namespace if (namespace === '' || namespace === ko.currentlyBindingNamespace) {