Skip to content
This repository was archived by the owner on Jan 16, 2020. It is now read-only.

Commit b2a1dd5

Browse files
author
InfinitiesLoop
committed
Updated readme, cleaned up dead code
1 parent 6e379ef commit b2a1dd5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ $.link( { source: ".foo", target: target, targetAttr: "field" } );
294294
$.unlink( { source: "#foo1", target: target, targetAttr: "field" } );
295295
</pre>
296296

297+
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:
298+
299+
<pre>
300+
$.unlink( { source: ".foo" } );
301+
</pre>
302+
297303
<strong>Automatic unlinking</strong><br/>
298304

299305
<p>
@@ -323,7 +329,7 @@ $.liveLink({
323329
</pre>
324330

325331
<p>
326-
Note however that currently you cannot use 'twoWay' on a live link. You may use 'update'.
332+
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.
327333
</p>
328334

329335
<h3>jQuery.unlinkLive</h3>

jQuery.datalink.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ $.link = function( settings, context ) {
341341
attr = formElems.test( nodeName ) ? "val" : "text";
342342
}
343343
}
344-
var handler = function(ev, reverse) {
344+
var handler = function(ev) {
345345
if ( !ev || source === ev.target ) {
346346
var _source = $(ev ? ev.target : source),
347347
newValue = ev ? ev.newValue : getValue( _source, attr ),
@@ -376,7 +376,8 @@ $.link = function( settings, context ) {
376376
index[ id ] = link;
377377
// listen to changes on the source
378378
$(source).attrChange( attr ? attr.split( ' ' ) : '', handler );
379-
if ( settings.update ) {
379+
// update if specified
380+
if ( settings.updateTarget ) {
380381
handler();
381382
}
382383
});

0 commit comments

Comments
 (0)