Skip to content

Commit 1e789ea

Browse files
author
InfinitiesLoop
committed
Updated sample, readme, and moved convertFn to $
1 parent 4701427 commit 1e789ea

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ Adds linkTo, linkFrom, and linkBoth plugins.
6767
$.push(arr, 4, 5);
6868

6969
// restricted scope
70-
$("push", [arr])
71-
.arrayChange(function(ev) {
70+
$([arr])
71+
.arrayChange("push", function(ev) {
7272
alert("Array operation " + ev.change + " executed with args " + ev.arguments);
7373
});
7474
// nothing
7575
$.pop(arr);
7676
// Array operation push executed with args 4,5
7777
$.push(arr, 4, 5);
7878

79-
$(["push", "pop", "splice"], [arr])
80-
.arrayChange(function(ev) {
79+
$([arr])
80+
.arrayChange(["push", "pop", "splice"], function(ev) {
8181
alert("Array operation " + ev.change + " executed with args " + ev.arguments);
8282
});
8383
// Array operation pop executed with args undefined

demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
var persons = [ person, person2 ];
2929

30-
$.fn.convertFn.enclose = function(value) {
30+
$.convertFn.enclose = function(value) {
3131
return "[" + value + "]";
3232
}
3333

jQuery.livelink.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ $.link = function( settings ) {
163163
// the contents, not the array itself
164164
source = $($.isArray( source ) ? [ source ] : source);
165165
target = $($.isArray( target ) ? [ target ] : target);
166-
convert = $.fn.convertFn[ convert ] || convert;
166+
convert = $.convertFn[ convert ] || convert;
167167
var isVal = sourceAttr === "val",
168168
targetFn = setter_lookup[targetAttr];
169169
function update(ev) {
@@ -198,11 +198,13 @@ $.link = function( settings ) {
198198
update();
199199
}
200200

201+
$.convertFn = {
202+
"!": function(value) {
203+
return !value;
204+
}
205+
};
206+
201207
$.fn.extend({
202-
convertFn: {
203-
"!": function() {
204-
}
205-
},
206208
linkFrom: function( targetAttr, source, sourceAttr, convert ) {
207209
var settings = {
208210
target: this

0 commit comments

Comments
 (0)