Skip to content

Commit

Permalink
Works with the latest master knockout branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunter Loftis committed Apr 6, 2011
1 parent bea8dbd commit dfc9bc7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 2 additions & 3 deletions README.md
@@ -1,8 +1,7 @@
# Important!

Currently waiting for a hook in Knockout to be merged.
If you're trying out namespaces now (awesome!), try them with
[the KO fork that adds the hook](https://github.com/hunterloftis/knockout)
knockout.namespaces requires hooks in Knockout that are only available
in [the latest KO master](https://github.com/SteveSanderson/knockout)

# Knockout.namespaces
Expand Down
4 changes: 3 additions & 1 deletion build/output/knockout.namespaces-latest.debug.js
Expand Up @@ -7,6 +7,8 @@

(function (ko) {

var bindingAttributeName = 'data-bind';

/* ko.applyBindings
*
* 4 method signatures:
Expand All @@ -25,7 +27,7 @@
namespace = (namespace && namespace.length > 0) ? ('-' + namespace) : ''; // Prefix -namespace
rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional
}
var bindingAttributeNameNs = ko.getBindingAttribute() + namespace,
var bindingAttributeNameNs = bindingAttributeName + namespace,
elemsWithBindingAttribute = ko.utils.getElementsHavingAttribute(rootNode, bindingAttributeNameNs);
ko.utils.arrayForEach(elemsWithBindingAttribute, function (element) {
ko.applyBindingsToNode(element, null, viewModel, bindingAttributeNameNs);
Expand Down
2 changes: 1 addition & 1 deletion build/output/knockout.namespaces-latest.js
@@ -1,4 +1,4 @@
// Knockout Namespaces plugin v0.1.0
// (c) 2011 Hunter Loftis, Chris Gomez - http://github.com/hunterloftis/knockout.ns
// License: Ms-Pl (http://www.opensource.org/licenses/ms-pl.html)
(function(b){b.applyBindings=function(e,a,c){a&&a.nodeType!==void 0?(c=a,a=""):(a=a&&a.length>0?"-"+a:"",c=c||window.document.body);var d=b.getBindingAttribute()+a;a=b.utils.getElementsHavingAttribute(c,d);b.utils.arrayForEach(a,function(a){b.applyBindingsToNode(a,null,e,d)})}})(ko);
(function(b){b.applyBindings=function(e,a,c){a&&a.nodeType!==void 0?(c=a,a=""):(a=a&&a.length>0?"-"+a:"",c=c||window.document.body);var d="data-bind"+a;a=b.utils.getElementsHavingAttribute(c,d);b.utils.arrayForEach(a,function(a){b.applyBindingsToNode(a,null,e,d)})}})(ko);
4 changes: 3 additions & 1 deletion knockout.namespaces.js
Expand Up @@ -4,6 +4,8 @@

(function (ko) {

var bindingAttributeName = 'data-bind';

/* ko.applyBindings
*
* 4 method signatures:
Expand All @@ -22,7 +24,7 @@
namespace = (namespace && namespace.length > 0) ? ('-' + namespace) : ''; // Prefix -namespace
rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional
}
var bindingAttributeNameNs = ko.getBindingAttribute() + namespace,
var bindingAttributeNameNs = bindingAttributeName + namespace,
elemsWithBindingAttribute = ko.utils.getElementsHavingAttribute(rootNode, bindingAttributeNameNs);
ko.utils.arrayForEach(elemsWithBindingAttribute, function (element) {
ko.applyBindingsToNode(element, null, viewModel, bindingAttributeNameNs);
Expand Down
2 changes: 2 additions & 0 deletions spec/nsBehaviors.js
Expand Up @@ -6,6 +6,8 @@ describe('Namespaces', {
'ko.applyBindings with a namespace should bind to that namespace'
'ko.applyBindings with a namespace should ignore unnamespaced data bindings'
'ko.applyBindings with a namespace should ignore non-matching namespaces'
'multiple calls to ko.applyBindings should bind newly created DOM elements'
'multiple calls to ko.applyBindings should not bind already bound DOM elements'
*/

})

0 comments on commit dfc9bc7

Please sign in to comment.