Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Pass the overwritten implementation to the builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Gnass committed Nov 15, 2010
1 parent 8ec065b commit e7ce183
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions jquery.dynaform.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@
}, },


register: function (builders) { register: function (builders) {
// Add raw builders to prototype.builders
$.extend(DynaForm.prototype.builders, builders);

$.each(builders, function (type, builder) { $.each(builders, function (type, builder) {
var prev = DynaForm.prototype[type]; var prev = DynaForm.prototype.builders[type];
DynaForm.prototype.builders[type] = builder;

DynaForm.prototype[type] = function () { DynaForm.prototype[type] = function () {
var args = $.makeArray(arguments), var args = $.makeArray(arguments),
shift = function (type) { shift = function (type) {
Expand All @@ -83,7 +82,9 @@
value: bind && this.data ? this.data[bind] : this.data value: bind && this.data ? this.data[bind] : this.data
} }
); );
var el = builder.call(this, options, prev).addClass(type);
var proxy = $.proxy(prev, this);
var el = builder.call(this, options, proxy).addClass(type);


if (options.label) { if (options.label) {
el = $('<div class="labeled">') el = $('<div class="labeled">')
Expand Down

0 comments on commit e7ce183

Please sign in to comment.