- },
-
- /**
- * Sets the value of a property, and updates the widget accordingly
- *
- * @param {Object} context
- * @param {string} property Name of property
- * @param {Mixed} value Value to set property with
- */
- configure: function ( context, property, value ) {
- var newCSS,
- $result, $results, $spanForWidth, childrenWidth,
- regionIsFixed, regionPosition,
- i, expWidth, maxWidth, text;
-
- // Validate creation using fallback values
- switch ( property ) {
- case 'fetch':
- case 'cancel':
- case 'special':
- case 'result':
- case 'update':
- case '$region':
- case 'expandFrom':
- context.config[ property ] = value;
- break;
- case 'suggestions':
- context.config[ property ] = value;
- // Update suggestions
- if ( context.data !== undefined ) {
- if ( context.data.$textbox.val().length === 0 ) {
- // Hide the div when no suggestion exist
- $.suggestions.hide( context );
- } else {
- // Rebuild the suggestions list
- context.data.$container.show();
- // Update the size and position of the list
- regionIsFixed = ( function () {
- var $el = context.config.$region;
- do {
- if ( $el.css( 'position' ) === 'fixed' ) {
- return true;
- }
- $el = $( $el[ 0 ].offsetParent );
- } while ( $el.length );
- return false;
- }() );
- regionPosition = regionIsFixed ?
- context.config.$region[ 0 ].getBoundingClientRect() :
- context.config.$region.offset();
- newCSS = {
- position: regionIsFixed ? 'fixed' : 'absolute',
- top: regionPosition.top + context.config.$region.outerHeight(),
- bottom: 'auto',
- width: context.config.$region.outerWidth(),
- height: 'auto'
- };
-
- // Process expandFrom, after this it is set to left or right.
- context.config.expandFrom = ( function ( expandFrom ) {
- var regionWidth, docWidth, regionCenter, docCenter,
- docDir = $( document.documentElement ).css( 'direction' ),
- $region = context.config.$region;
-
- // Backwards compatible
- if ( context.config.positionFromLeft ) {
- expandFrom = 'left';
-
- // Catch invalid values, default to 'auto'
- } else if ( [ 'left', 'right', 'start', 'end', 'auto' ].indexOf( expandFrom ) === -1 ) {
- expandFrom = 'auto';
+ context.data.$textbox.trigger( 'change' );
+ }
+ }
+
+ /**
+ * Sets the value of a property, and updates the widget accordingly
+ *
+ * @param {Object} context
+ * @param {string} property Name of property
+ * @param {Mixed} value Value to set property with
+ */
+ function configure( context, property, value ) {
+ var newCSS,
+ $result, $results, $spanForWidth, childrenWidth,
+ regionIsFixed, regionPosition,
+ i, expWidth, maxWidth, text;
+
+ // Validate creation using fallback values
+ switch ( property ) {
+ case 'fetch':
+ case 'cancel':
+ case 'special':
+ case 'result':
+ case 'update':
+ case '$region':
+ case 'expandFrom':
+ context.config[ property ] = value;
+ break;
+ case 'suggestions':
+ context.config[ property ] = value;
+ // Update suggestions
+ if ( context.data !== undefined ) {
+ if ( context.data.$textbox.val().length === 0 ) {
+ // Hide the div when no suggestion exist
+ hide( context );
+ } else {
+ // Rebuild the suggestions list
+ context.data.$container.show();
+ // Update the size and position of the list
+ regionIsFixed = ( function () {
+ var $el = context.config.$region;
+ do {
+ if ( $el.css( 'position' ) === 'fixed' ) {
+ return true;