Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

v0.2.1

  • Loading branch information...
commit e08fdf17f4358f68f595f765b9b97448ef9d9180 1 parent 53ce1ee
politician authored

Showing 1 changed file with 157 additions and 157 deletions. Show diff stats Hide diff stats

  1. +157 157 outback.js
314 outback.js
... ... @@ -1,4 +1,4 @@
1   -/* outback.js v0.2.0 - a data binding library for backbone
  1 +/* outback.js v0.2.1 - a data binding library for backbone
2 2 (c) David Zarlengo -- http://github.com/politician/outback
3 3 License: MIT (http://www.opensource.org/licenses/mit-license.php)
4 4 */
@@ -14,7 +14,7 @@
14 14 }
15 15 }(this, function($, _, Backbone, rj) {
16 16
17   - var stringTrimRegex = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
  17 + var stringTrimRegex = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
18 18
19 19 function stringTrim (string) {
20 20 return (string || "").replace(stringTrimRegex, "");
@@ -77,7 +77,7 @@
77 77 changeSetOptions = {};
78 78
79 79 if (!!options.silent) {
80   - changeSetOptions.silent = true;
  80 + changeSetOptions.silent = true;
81 81 }
82 82
83 83 if (!!options.previewError) {
@@ -106,7 +106,7 @@
106 106 model.off(eventName);
107 107 };
108 108
109   - return {
  109 + return {
110 110 modelAttrName: modelAttrName,
111 111 valueAccessor: makeValueAccessorBuilder(model),
112 112 modelEvents: {
@@ -114,7 +114,7 @@
114 114 subscribe: subscribe,
115 115 unsubscribe: unsubscribe
116 116 }
117   - };
  117 + };
118 118 }
119 119
120 120 function makeBindingDecl (model, symbol) {
@@ -135,26 +135,26 @@
135 135
136 136 function makeDataBindAttrBindingDeclReviver (model) {
137 137 function parseSymbol (value) {
138   - return !!value
139   - && hop(value, '__symbol_literal')
140   - && value['__symbol_literal'];
  138 + return !!value
  139 + && hop(value, '__symbol_literal')
  140 + && value['__symbol_literal'];
141 141 }
142 142
143 143 return function(k, value) {
144 144 return makeBindingDecl (model, parseSymbol(value)) || value;
145   - };
  145 + };
146 146 }
147 147
148 148 function makeUnobtrusiveBindingDeclReviver (model) {
149 149 function parseSymbol (value) {
150   - return !!value
151   - && value instanceof OutbackModelRef
152   - && value.modelAttrName;
  150 + return !!value
  151 + && value instanceof OutbackModelRef
  152 + && value.modelAttrName;
153 153 }
154 154
155 155 return function(k, value) {
156 156 return makeBindingDecl (model, parseSymbol(value)) || value;
157   - };
  157 + };
158 158 }
159 159
160 160 function parseDataBindAttrBindingDecls (databindAttr, view, model) {
@@ -163,7 +163,7 @@
163 163 bindingDecls = [];
164 164 selector = "["+databindAttr+"]";
165 165
166   - view.$(selector).each(function () {
  166 + view.$(selector).each(function () {
167 167 var element, bindingExpr, directives;
168 168
169 169 element = view.$(this);
@@ -227,7 +227,7 @@
227 227 allBindings = {};
228 228 executableBindings = [];
229 229
230   - allBindingsAccessor = function() {
  230 + allBindingsAccessor = function() {
231 231 var args, modelAttr;
232 232 args = Array.prototype.slice.call(arguments);
233 233 if (args.length === 0) {
@@ -260,7 +260,7 @@
260 260 delete binding.valueAccessor;
261 261 }
262 262
263   - allBindings[key] = binding;
  263 + allBindings[key] = binding;
264 264 });
265 265
266 266 return executableBindings;
@@ -299,15 +299,15 @@
299 299
300 300 updateFn = binding.handler.update;
301 301
302   - binders.updates.push(fn = function() {
303   - updateFn.apply(view, binderArgs);
  302 + binders.updates.push(fn = function() {
  303 + updateFn.apply(view, binderArgs);
304 304 });
305 305
306 306 fn.priority = +binding.handler.updatePriority || 10;
307 307
308 308 binders.modelSubs.push(function() {
309 309 binding.modelEvents.subscribe(binding.modelEvents.eventName, function(m, val) {
310   - updateFn.apply(view, binderArgs);
  310 + updateFn.apply(view, binderArgs);
311 311 });
312 312 });
313 313
@@ -317,17 +317,17 @@
317 317
318 318 if (hop(binding.handler, 'init')) {
319 319 binders.inits.push(function() {
320   - binding.handler.init.apply(view, binderArgs);
  320 + binding.handler.init.apply(view, binderArgs);
321 321 });
322 322 }
323 323
324 324 if (hop(binding.handler, 'remove')) {
325   - binders.removes.push(function() {
326   - binding.handler.remove.apply(view, binderArgs);
  325 + binders.removes.push(function() {
  326 + binding.handler.remove.apply(view, binderArgs);
327 327 });
328   - }
  328 + }
329 329
330   - return binders;
  330 + return binders;
331 331 }
332 332
333 333 var OutbackModelRef = function (modelAttrName) {
@@ -344,7 +344,7 @@
344 344 removes: [],
345 345 modelUnsubs: []
346 346 };
347   -
  347 +
348 348 bindingContexts = {
349 349 model: {
350 350 dataSource: view.model,
@@ -382,7 +382,7 @@
382 382 arrayConcat(bindings, filterExecutableBindings(bindingDecl, bindingHandlers));
383 383 });
384 384
385   - _.each(bindings, function (binding) {
  385 + _.each(bindings, function (binding) {
386 386 improveExecutableBinding(binding, view);
387 387 });
388 388
@@ -423,8 +423,8 @@
423 423 eachfn(allBinders.modelUnsubs);
424 424 eachfn(allBinders.removes);
425 425 }
426   - };
427   -
  426 + };
  427 +
428 428 // PUBLIC API FOR BACKBONE VIEWS
429 429 // @render: -> Backbone.outback.bind @
430 430 // @remove: -> Backbone.outback.unbind @
@@ -445,7 +445,7 @@
445 445 return new OutbackModelRef(modelAttrName);
446 446 },
447 447
448   - bindingHandlers: {}
  448 + bindingHandlers: {}
449 449 };
450 450
451 451 Backbone.View.prototype.modelref = function(name) {
@@ -466,15 +466,15 @@
466 466
467 467 @modelAttr is interpreted as truthy or falsy
468 468
469   - Purpose: The visible binding causes the associated DOM element to
470   - become hidden or visible according to the value you pass to the
  469 + Purpose: The visible binding causes the associated DOM element to
  470 + become hidden or visible according to the value you pass to the
471 471 binding.
472 472 */
473 473 Backbone.outback.bindingHandlers['visible'] = (function() {
474 474 return {
475 475 update: function (element, valueAccessor, allBindingsAccessor, view) {
476 476 var value, names, index;
477   -
  477 +
478 478 var names = ['show', 'hide'];
479 479 var index = !!valueAccessor()() ? 0 : 1;
480 480
@@ -490,21 +490,21 @@
490 490
491 491 @modelAttr is interpreted as truthy or falsy
492 492
493   - Purpose: The invisible binding causes the associated DOM element
494   - to become hidden or visible according to the value you pass to the
  493 + Purpose: The invisible binding causes the associated DOM element
  494 + to become hidden or visible according to the value you pass to the
495 495 binding.
496 496 */
497 497 Backbone.outback.bindingHandlers['invisible'] = (function() {
498 498 return {
499 499 update: function (element, valueAccessor, allBindingsAccessor, view) {
500 500 var value, names, index;
501   -
  501 +
502 502 var names = ['hide', 'show'];
503 503 var index = !!valueAccessor()() ? 0 : 1;
504 504
505 505 $(element)[names[index]]();
506 506 }
507   - }
  507 + }
508 508 })();
509 509
510 510 /* The "text" binding
@@ -513,7 +513,7 @@
513 513 data-bind="text: @modelAttr, textOptions: { escape: <truthy> }"
514 514
515 515 escape controls whether or not an HTML-escaped version of a model's
516   - attribute is used. Using escape to retrieve attributes will
  516 + attribute is used. Using escape to retrieve attributes will
517 517 prevent XSS attacks. The default is true.
518 518
519 519 Purpose: The text binding causes the associated DOM element to display
@@ -526,12 +526,12 @@
526 526 config = {
527 527 escape: true
528 528 };
529   -
  529 +
530 530 options = allBindingsAccessor('textOptions');
531 531 if (options && hop(options, 'escape')) {
532 532 config.escape = !!options.escape;
533 533 }
534   -
  534 +
535 535 return config;
536 536 }
537 537
@@ -555,7 +555,7 @@
555 555 the HTML specified by your parameter.
556 556
557 557 Remarks: The escape option is not honored by this binding because
558   - jQuery provides its own XSS protection.
  558 + jQuery provides its own XSS protection.
559 559 */
560 560 Backbone.outback.bindingHandlers['html'] = (function() {
561 561 return {
@@ -599,7 +599,7 @@
599 599 config.not = !!options.not;
600 600 }
601 601 }
602   -
  602 +
603 603 return config;
604 604 }
605 605
@@ -625,9 +625,9 @@
625 625 data-bind="attr: { attr1: @modelAttr1, attr2: @modelAttr2, attr2Options: { escape: <truthy> } }"
626 626
627 627 @modelAttr is interpreted as attribute values
628   -
  628 +
629 629 escape controls whether or not an HTML-escaped version of a model's
630   - attribute is used. Using escape to retrieve attributes will
  630 + attribute is used. Using escape to retrieve attributes will
631 631 prevent XSS attacks. The default is true.
632 632
633 633 Purpose: The attr binding provides a generic way to set the value of
@@ -659,7 +659,7 @@
659 659 config.escape = !!options.escape;
660 660 }
661 661 }
662   -
  662 +
663 663 return config;
664 664 }
665 665
@@ -691,14 +691,14 @@
691 691
692 692 // Working with Form Fields
693 693 // ===================================
694   -
  694 +
695 695 /* The "enable" binding
696 696
697 697 Usage:
698 698 data-bind="enable: @modelAttr"
699 699
700 700 @modelAttr is interpreted as truthy or falsy
701   -
  701 +
702 702 Purpose: The enable binding causes the associated DOM element to be
703 703 enabled only when the parameter value is true.
704 704 */
@@ -711,14 +711,14 @@
711 711 }
712 712 }
713 713 })();
714   -
  714 +
715 715 /* The "disable" binding
716 716
717 717 Usage:
718 718 data-bind="disable: @modelAttr"
719 719
720 720 @modelAttr is interpreted as truthy or falsy
721   -
  721 +
722 722 Purpose: The disable binding causes the associated DOM element to be
723 723 disable only when the parameter value is true.
724 724 */
@@ -740,14 +740,14 @@
740 740 valueUpdate defaults to 'change' if not specified
741 741
742 742 escape controls whether or not an HTML-escaped version of a model's
743   - attribute is used. Using escape to retrieve attributes will
  743 + attribute is used. Using escape to retrieve attributes will
744 744 prevent XSS attacks. The default is true.
745 745
746 746 silent determines whether setting the model triggers validation.
747 747 The default is false.
748 748
749   - Purpose: The value binding links the associated DOM element’s value
750   - with a property on your view model. This is typically useful with
  749 + Purpose: The value binding links the associated DOM element’s value
  750 + with a property on your view model. This is typically useful with
751 751 form elements such as <input>, <select> and <textarea>.
752 752 */
753 753 Backbone.outback.bindingHandlers['value'] = (function() {
@@ -777,11 +777,11 @@
777 777 if(options && hop(options, 'silent')) {
778 778 config.silent = !!options.silent;
779 779 }
780   -
  780 +
781 781 return config;
782 782 }
783 783
784   - return {
  784 + return {
785 785 init: function (element, valueAccessor, allBindingsAccessor, view) {
786 786 var config, writeOptions;
787 787 config = optionsFor(element, valueAccessor, allBindingsAccessor);
@@ -810,14 +810,14 @@
810 810 var config;
811 811 config = optionsFor(element, valueAccessor, allBindingsAccessor);
812 812
813   - $(element).off(config.eventName);
  813 + $(element).off(config.eventName);
814 814 },
815 815 previewError: function (element, valueAccessor, allBindingsAccessor, view, e) {
816 816 var error = e.error;
817 817 // TODO: Do something useful.
818 818 e.preventDefault = false;
819 819 }
820   - }
  820 + }
821 821 })();
822 822
823 823 /* The "hasfocus" binding
@@ -830,14 +830,14 @@
830 830 Purpose: The hasfocus binding links a DOM element’s focus state with a
831 831 model property. It is a two-way binding, so:
832 832
833   - * If you set the viewmodel property to true or false, the
  833 + * If you set the viewmodel property to true or false, the
834 834 associated element will become focused or unfocused.
835 835
836 836 * If the user manually focuses or unfocuses the associated element,
837 837 the model property will be set to true or false accordingly. This
838   - is useful if you’re building sophisticated forms in which
839   - editable elements appear dynamically, and you would like to
840   - control where the user should start typing, or respond to the
  838 + is useful if you’re building sophisticated forms in which
  839 + editable elements appear dynamically, and you would like to
  840 + control where the user should start typing, or respond to the
841 841 location of the caret.
842 842 */
843 843 Backbone.outback.bindingHandlers['hasfocus'] = (function() {
@@ -867,7 +867,7 @@
867 867 },
868 868 remove: function (element, valueAccessor, allBindingsAccessor, view) {
869 869 $(element).off('focus blur');
870   - }
  870 + }
871 871 };
872 872 })();
873 873
@@ -876,12 +876,12 @@
876 876 Usage:
877 877 data-bind="checked: @modelAttr"
878 878
879   - if the element is a checkbox, then @modelAttr is interpreted as
  879 + if the element is a checkbox, then @modelAttr is interpreted as
880 880 truthy or falsy; otherwise, if the element is a radio button
881 881 @modelAttr is interpreted as the value of the radio button
882 882
883   - Purpose: The checked binding links a checkable form control — i.e., a
884   - checkbox (<input type='checkbox'>) or a radio button
  883 + Purpose: The checked binding links a checkable form control — i.e., a
  884 + checkbox (<input type='checkbox'>) or a radio button
885 885 (<input type='radio'>) — with a property on your view model.
886 886 */
887 887 Backbone.outback.bindingHandlers['checked'] = (function() {
@@ -893,14 +893,14 @@
893 893 } else{
894 894 label = $el.val();
895 895 return label;
896   - }
  896 + }
897 897 }
898 898
899 899 function domWrite($el, actual) {
900 900 var checked, value, comparand;
901 901 switch($el.attr('type')) {
902 902 case 'radio':
903   - value = $el.val();
  903 + value = $el.val();
904 904 comparand = _.isString(value) ? '' + actual : actual;
905 905 checked = value === comparand
906 906 $el.prop('checked', checked);
@@ -913,14 +913,14 @@
913 913 break;
914 914 }
915 915 }
916   -
  916 +
917 917 return {
918 918 init: function (element, valueAccessor, allBindingsAccessor, view) {
919 919 $(element).on('change', function (e) {
920 920 var domValue;
921 921 domValue = domRead($(element));
922 922 valueAccessor()(domValue);
923   - });
  923 + });
924 924 },
925 925 update: function (element, valueAccessor, allBindingsAccessor, view) {
926 926 var value;
@@ -929,7 +929,7 @@
929 929 },
930 930 remove: function (element, valueAccessor, allBindingsAccessor, view) {
931 931 $(element).off('change');
932   - }
  932 + }
933 933 };
934 934 })();
935 935
@@ -937,7 +937,7 @@
937 937 // Working with Collections
938 938 // ===============================
939 939
940   -
  940 +
941 941 // Other Miscellaneous Bindings
942 942 // ===============================
943 943
@@ -966,12 +966,12 @@
966 966 word: 'item',
967 967 lang: 'enUS'
968 968 };
969   -
  969 +
970 970 options = allBindingsAccessor('pluralOptions');
971 971 if (options && hop(options, 'word')) {
972 972 config.word = ''+options.word;
973 973 }
974   -
  974 +
975 975 return config;
976 976 }
977 977
@@ -1010,7 +1010,7 @@
1010 1010 formatspec is a string which describes how a monetary value must be
1011 1011 rendered. This string must match the RegExp,
1012 1012
1013   - /^([^\d]*)9([^\d]?)999([^\d])99([^\d]*)$/
  1013 + /^([^\d]*)9([^\d]?)999([^\d])99([^\d]*)$/
1014 1014
1015 1015 where the capture groups are interpreted as follows:
1016 1016
@@ -1021,10 +1021,10 @@
1021 1021
1022 1022 The default format specifier is '$9,999.99'.
1023 1023
1024   - negativeClass is the name of a CSS class to add to the element
  1024 + negativeClass is the name of a CSS class to add to the element
1025 1025 when the value is less than 0. The default is 'currency-negative'.
1026 1026
1027   - Purpose: The currency binding causes the associated DOM element to
  1027 + Purpose: The currency binding causes the associated DOM element to
1028 1028 display the text value of the bound symbol formatted as a currency.
1029 1029 */
1030 1030 Backbone.outback.bindingHandlers['currency'] = (function() {
@@ -1034,7 +1034,7 @@
1034 1034 config = {
1035 1035 format: [ '$', ',', '.', '' ]
1036 1036 };
1037   -
  1037 +
1038 1038 options = allBindingsAccessor('currencyOptions');
1039 1039 if (options && hop(options, 'format')) {
1040 1040 config.format = parseFormatSpec(options.format) || config.format;
@@ -1054,27 +1054,27 @@
1054 1054 }
1055 1055
1056 1056 // http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript
1057   - // with modifications to specify radix in parseInt, to wrap negative values in parens, and
  1057 + // with modifications to specify radix in parseInt, to wrap negative values in parens, and
1058 1058 // to display a currency symbol if specified
1059 1059 function formatMoney (c, prefix, t, d, suffix) {
1060   - var n = this,
1061   - c = isNaN(c = Math.abs(c)) ? 2 : c,
1062   - d = d == undefined ? "," : d,
1063   - t = t == undefined ? "." : t,
  1060 + var n = this,
  1061 + c = isNaN(c = Math.abs(c)) ? 2 : c,
  1062 + d = d == undefined ? "," : d,
  1063 + t = t == undefined ? "." : t,
1064 1064 s1 = n < 0 ? "(" : "",
1065 1065 s2 = n < 0 ? ")" : "",
1066 1066 prefix = prefix == undefined ? "" : prefix,
1067 1067 suffix = suffix == undefined ? "" : suffix,
1068   - i = parseInt(n = Math.abs(+n || 0).toFixed(c), 10) + "",
  1068 + i = parseInt(n = Math.abs(+n || 0).toFixed(c), 10) + "",
1069 1069 j = (j = i.length) > 3 ? j % 3 : 0;
1070 1070
1071   - return s1
1072   - + prefix
1073   - + (j ? i.substr(0, j) + t : "")
1074   - + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t)
1075   - + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "")
1076   - + suffix
1077   - + s2;
  1071 + return s1
  1072 + + prefix
  1073 + + (j ? i.substr(0, j) + t : "")
  1074 + + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t)
  1075 + + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "")
  1076 + + suffix
  1077 + + s2;
1078 1078 };
1079 1079
1080 1080 return {
@@ -1090,7 +1090,7 @@
1090 1090
1091 1091 parseFormatSpec: parseFormatSpec
1092 1092 }
1093   - })();
  1093 + })();
1094 1094
1095 1095 /* The "date" binding
1096 1096
@@ -1106,87 +1106,87 @@
1106 1106 display the text value of the bound symbol formatted as a date.
1107 1107 */
1108 1108 Backbone.outback.bindingHandlers['date'] = (function () {
1109   - function optionsFor(valueAccessor, allBindingsAccessor) {
1110   - var config, options;
  1109 + function optionsFor(valueAccessor, allBindingsAccessor) {
  1110 + var config, options;
1111 1111
1112   - config = {
1113   - format: 'yyyy-MM-dd'
1114   - };
  1112 + config = {
  1113 + format: 'yyyy-MM-dd'
  1114 + };
1115 1115
1116   - options = allBindingsAccessor('dateOptions');
1117   - if (options && hop(options, 'format')) {
1118   - config.format = options.format;
1119   - }
  1116 + options = allBindingsAccessor('dateOptions');
  1117 + if (options && hop(options, 'format')) {
  1118 + config.format = options.format;
  1119 + }
1120 1120
1121   - return config;
1122   - }
  1121 + return config;
  1122 + }
1123 1123
1124   - function formatDate(value, format) {
1125   - var d;
1126   - d = Date.parse(value);
1127   - return _.isNaN(d) || !d ? '' : d.toString(format);
1128   - }
  1124 + function formatDate(value, format) {
  1125 + var d;
  1126 + d = Date.parse(value);
  1127 + return _.isNaN(d) || !d ? '' : d.toString(format);
  1128 + }
1129 1129
1130   - return {
1131   - update: function (element, valueAccessor, allBindingsAccessor, view) {
1132   - var config, value;
1133   - config = optionsFor(valueAccessor, allBindingsAccessor);
  1130 + return {
  1131 + update: function (element, valueAccessor, allBindingsAccessor, view) {
  1132 + var config, value;
  1133 + config = optionsFor(valueAccessor, allBindingsAccessor);
1134 1134
1135   - value = valueAccessor()();
1136   - value = formatDate(value, config.format);
  1135 + value = valueAccessor()();
  1136 + value = formatDate(value, config.format);
1137 1137
1138   - $(element).text(value);
1139   - }
1140   - };
  1138 + $(element).text(value);
  1139 + }
  1140 + };
1141 1141
1142 1142 })();
1143 1143
1144 1144
1145 1145 /* The "options" binding
1146 1146
1147   - Usage:
1148   - data-bind="options: @modelAttr, optionsOptions: { }"
  1147 + Usage:
  1148 + data-bind="options: @modelAttr, optionsOptions: { }"
1149 1149
1150   - Purpose: The options binding is designed to support loading
1151   - options for select controls. The binding looks for the CSS
1152   - selector specified by @modelAttr, and replaces the contents
1153   - of the associated DOM element.
  1150 + Purpose: The options binding is designed to support loading
  1151 + options for select controls. The binding looks for the CSS
  1152 + selector specified by @modelAttr, and replaces the contents
  1153 + of the associated DOM element.
1154 1154 */
1155 1155 Backbone.outback.bindingHandlers['options'] = (function () {
1156   - function optionsFor(valueAccessor, allBindingsAccessor) {
1157   - var config, options;
1158   -
1159   - config = {
1160   - noContent: '<optgroup label="outback: No optgroups or options found"></optgroup>'
1161   - };
1162   -
1163   - options = allBindingsAccessor('optionsOptions');
1164   -
1165   - return config;
1166   - }
1167   -
1168   - return {
1169   - update: function (element, valueAccessor, allBindingsAccessor, view) {
1170   - var config, value, s, $options, $el;
1171   - config = optionsFor(valueAccessor, allBindingsAccessor);
1172   -
1173   - value = valueAccessor()();
1174   - $el = $(value);
1175   -
1176   - // If it's a script, unpack it.
1177   - if (($options = $el.filter('script')).size() > 0) {
1178   - $el = $($options.html());
1179   - }
1180   -
1181   - // Otherwise, append the options and optgroups; or nothing.
1182   - if (($options = $el.filter('optgroup, option')).size() > 0) {
1183   - $(element).empty().append($options);
1184   - } else {
1185   - $(element).html(config.noContent);
1186   - }
1187   - },
1188   - updatePriority: 1
1189   - };
1190   - }());
1191   -
1192   -}));
  1156 + function optionsFor(valueAccessor, allBindingsAccessor) {
  1157 + var config, options;
  1158 +
  1159 + config = {
  1160 + noContent: '<optgroup label="outback: No optgroups or options found"></optgroup>'
  1161 + };
  1162 +
  1163 + options = allBindingsAccessor('optionsOptions');
  1164 +
  1165 + return config;
  1166 + }
  1167 +
  1168 + return {
  1169 + update: function (element, valueAccessor, allBindingsAccessor, view) {
  1170 + var config, value, s, $options, $el;
  1171 + config = optionsFor(valueAccessor, allBindingsAccessor);
  1172 +
  1173 + value = valueAccessor()();
  1174 + $el = $(value);
  1175 +
  1176 + // If it's a script, unpack it.
  1177 + if (($options = $el.filter('script')).size() > 0) {
  1178 + $el = $($options.html());
  1179 + }
  1180 +
  1181 + // Otherwise, append the options and optgroups; or nothing.
  1182 + if (($options = $el.filter('optgroup, option')).size() > 0) {
  1183 + $(element).empty().append($options);
  1184 + } else {
  1185 + $(element).html(config.noContent);
  1186 + }
  1187 + },
  1188 + updatePriority: 1
  1189 + };
  1190 + }());
  1191 +
  1192 +}));

0 comments on commit e08fdf1

Please sign in to comment.
Something went wrong with that request. Please try again.