( function () {
- var hasOwn = Object.hasOwnProperty;
-
/**
* Cancel any delayed maybeFetch() call and callback the context so
* they can cancel any async fetching if they use AJAX or something.
) {
context.data.prevText = val;
// Try cache first
- if ( context.config.cache && hasOwn.call( cache, val ) ) {
+ if ( context.config.cache && val in cache ) {
if ( mw.now() - cache[ val ].timestamp < context.config.cacheMaxAge ) {
context.data.$textbox.suggestions( 'suggestions', cache[ val ].suggestions );
if ( typeof context.config.update.after === 'function' ) {
} else {
// Expand from right
newCSS.left = 'auto';
- newCSS.right = $( 'body' ).width() - ( regionPosition.left + context.config.$region.outerWidth() );
+ newCSS.right = document.documentElement.clientWidth -
+ ( regionPosition.left + context.config.$region.outerWidth() );
}
context.data.$container.css( newCSS );
prevText: null,
// Cache of fetched suggestions
- cache: {},
+ cache: Object.create( null ),
// Number of results visible without scrolling
visibleResults: 0,
);
} )
)
- .appendTo( $( 'body' ) );
+ .appendTo( document.body );
$( this )
// Stop browser autocomplete from interfering