1
0
Fork 0

Accept jQuery in GeneralStepUi

This defaults to the global jQuery just so we don't break
everything (BC); that'll be removed in the future.

* src/ui/step/GeneralStepUi.js (__construct): Accept jQuery.
  (setContent): Use jQuery instance passed via ctor
master
Mike Gerwitz 2016-08-05 11:41:27 -04:00
parent 72f29a9734
commit 66f78c8886
1 changed files with 23 additions and 2 deletions

View File

@ -101,6 +101,12 @@ module.exports = Class( 'GeneralStepUi' )
*/
step: null,
/**
* jQuery instance
* @type {jQuery}
*/
'private _jquery': null,
/**
* Step data (DOM representation)
* @type {jQuery}
@ -187,17 +193,32 @@ module.exports = Class( 'GeneralStepUi' )
* until the data loading is complete. That is when the callback will be
* triggered.
*
* TODO: Remove jQuery
*
* @param {Step} step step to render
* @param {ElementStyler} styler element styler
* @param {BucketDataValidator} formatter validator/formatter
* @param {jQuery} jquery jQuery instance
*
* @return {undefined}
*/
'public __construct': function(
step,
styler,
formatter
formatter,
jquery
)
{
this.step = step;
this.styler = styler;
this._formatter = formatter;
// TODO: transition code; remove default
this._jquery = jquery || (
( typeof $ !== 'undefined' )
? $
: undefined
);
},
@ -246,7 +267,7 @@ module.exports = Class( 'GeneralStepUi' )
'public setContent': function( content )
{
// TODO: transition away from jQuery
this.$content = $( content );
this.$content = this._jquery( content );
this._processAnswerFields();