You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 16, 2020. It is now read-only.
Work on declarative linking from html to object, and from object to object, including nested objects.
The markup could be produced by nested jQuery templates. (To do).
Declarative binding from html to object working for top-level fields.
Nested binding from html to object not yet completed.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# jQuery Data Link plugin plugin v1.0.0pre.
1
+
# jQuery Data Link plugin v1.0.0pre.
2
2
3
3
_Note: This plugin is currently in beta form and may change significantly before version 1.0 is released. See tagged versions for stable Beta releases. Requires jquery version 1.4.2._
// Helper for --- TODO clean up between different cases....
122
+
123
+
functionfindJqObject(jqObject,type){
89
124
varobject,nodeName,path,linkedElems,
90
125
length=jqObject.length;
91
126
92
127
if(length){
93
128
object=jqObject[0];
94
-
if(object.nodeType){
129
+
if(object.nodeType&&type!=="from"){
95
130
path=thisMap[type];
96
131
if(path){
97
132
@@ -104,14 +139,14 @@ function addBinding( map, from, to, callback, links ) {
104
139
105
140
jqObject=jqObject.find(path).add(jqObject.filter(path));// TODO REPLACE BY ABOVE in the case of default binding, and remove support for random default binding - if perf concerns require it...
106
141
thisMap[type]=0;
107
-
thisMap[type+"Attr"]="default";
108
142
}
109
143
}elseif(length>1){
110
144
jqObject=$([jqObject.get()]);// For objects: don't wrap multiples - consider as equivalent to a jQuery object containing single object - namely the array of objects.
111
145
}
112
146
}
113
147
returnjqObject;
114
148
}
149
+
// ============================
115
150
116
151
varthisMap=typeofmap==="string" ? {to: map} : map&&$.extend({},map);// Note: "string" corresponds to 'to'. Is this intuitive? It is useful for filtering object copy: $.link( person, otherPerson, ["lastName", "address.city"] );
117
152
@@ -131,7 +166,7 @@ function addBinding( map, from, to, callback, links ) {
// TODO Verify optimization for memory footprint in closure captured by handlers, and perf optimization for using function declaration rather than statement?
136
171
handler=function(ev,eventArgs){
137
172
varcancel,sourceValue,sourcePath,
@@ -142,7 +177,7 @@ function addBinding( map, from, to, callback, links ) {
142
177
varsetter,fromAttr,$source;
143
178
144
179
fromAttr=thisMap.fromAttr;
145
-
if(fromAttr==="default"){
180
+
if(!fromAttr){
146
181
// Merge in the default attribute bindings for this source element
0 commit comments