Permalink
Browse files

Updated readme, cleaned up dead code

  • Loading branch information...
InfinitiesLoop
InfinitiesLoop committed Jun 2, 2010
1 parent 6e379ef commit b2a1dd58e8cfa7314d8826edb943b664d5aa68e7
Showing with 10 additions and 3 deletions.
  1. +7 −1 README.md
  2. +3 −2 jQuery.datalink.js
View
@@ -294,6 +294,12 @@ $.link( { source: ".foo", target: target, targetAttr: "field" } );
$.unlink( { source: "#foo1", target: target, targetAttr: "field" } );
</pre>
+Also, you may remove many links at once by omiting some of the values. For example, this unlinks all links whose source is an element with class foo:
+
+<pre>
+$.unlink( { source: ".foo" } );
+</pre>
+
<strong>Automatic unlinking</strong><br/>
<p>
@@ -323,7 +329,7 @@ $.liveLink({
</pre>
<p>
-Note however that currently you cannot use 'twoWay' on a live link. You may use 'update'.
+Note however that currently you cannot use 'twoWay' on a live link. You may use 'update'. Also, you may use 'convert', but there may only be one converter used by all the sources. The conversion function can access the particular source causing the change to determine any specifics needed to do the conversion.
</p>
<h3>jQuery.unlinkLive</h3>
View
@@ -341,7 +341,7 @@ $.link = function( settings, context ) {
attr = formElems.test( nodeName ) ? "val" : "text";
}
}
- var handler = function(ev, reverse) {
+ var handler = function(ev) {
if ( !ev || source === ev.target ) {
var _source = $(ev ? ev.target : source),
newValue = ev ? ev.newValue : getValue( _source, attr ),
@@ -376,7 +376,8 @@ $.link = function( settings, context ) {
index[ id ] = link;
// listen to changes on the source
$(source).attrChange( attr ? attr.split( ' ' ) : '', handler );
- if ( settings.update ) {
+ // update if specified
+ if ( settings.updateTarget ) {
handler();
}
});

0 comments on commit b2a1dd5

Please sign in to comment.