/src/main/resources/org/apache/struts2/static/autocomplete/autocomplete-debug.js
JavaScript | 2908 lines | 1343 code | 279 blank | 1286 comment | 372 complexity | 4c9f18b74e0a2ac25136d6e9e77ad62b MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- /*
- Copyright (c) 2009, Yahoo! Inc. All rights reserved.
- Code licensed under the BSD License:
- http://developer.yahoo.net/yui/license.txt
- version: 2.7.0
- */
- /////////////////////////////////////////////////////////////////////////////
- //
- // YAHOO.widget.DataSource Backwards Compatibility
- //
- /////////////////////////////////////////////////////////////////////////////
- YAHOO.widget.DS_JSArray = YAHOO.util.LocalDataSource;
- YAHOO.widget.DS_JSFunction = YAHOO.util.FunctionDataSource;
- YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) {
- var DS = new YAHOO.util.XHRDataSource(sScriptURI, oConfigs);
- DS._aDeprecatedSchema = aSchema;
- return DS;
- };
- YAHOO.widget.DS_ScriptNode = function(sScriptURI, aSchema, oConfigs) {
- var DS = new YAHOO.util.ScriptNodeDataSource(sScriptURI, oConfigs);
- DS._aDeprecatedSchema = aSchema;
- return DS;
- };
- YAHOO.widget.DS_XHR.TYPE_JSON = YAHOO.util.DataSourceBase.TYPE_JSON;
- YAHOO.widget.DS_XHR.TYPE_XML = YAHOO.util.DataSourceBase.TYPE_XML;
- YAHOO.widget.DS_XHR.TYPE_FLAT = YAHOO.util.DataSourceBase.TYPE_TEXT;
- // TODO: widget.DS_ScriptNode.scriptCallbackParam
- /**
- * The AutoComplete control provides the front-end logic for text-entry suggestion and
- * completion functionality.
- *
- * @module autocomplete
- * @requires yahoo, dom, event, datasource
- * @optional animation
- * @namespace YAHOO.widget
- * @title AutoComplete Widget
- */
- /****************************************************************************/
- /****************************************************************************/
- /****************************************************************************/
- /**
- * The AutoComplete class provides the customizable functionality of a plug-and-play DHTML
- * auto completion widget. Some key features:
- * <ul>
- * <li>Navigate with up/down arrow keys and/or mouse to pick a selection</li>
- * <li>The drop down container can "roll down" or "fly out" via configurable
- * animation</li>
- * <li>UI look-and-feel customizable through CSS, including container
- * attributes, borders, position, fonts, etc</li>
- * </ul>
- *
- * @class AutoComplete
- * @constructor
- * @param elInput {HTMLElement} DOM element reference of an input field.
- * @param elInput {String} String ID of an input field.
- * @param elContainer {HTMLElement} DOM element reference of an existing DIV.
- * @param elContainer {String} String ID of an existing DIV.
- * @param oDataSource {YAHOO.widget.DataSource} DataSource instance.
- * @param oConfigs {Object} (optional) Object literal of configuration params.
- */
- YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) {
- if(elInput && elContainer && oDataSource) {
- // Validate DataSource
- if(oDataSource instanceof YAHOO.util.DataSourceBase) {
- this.dataSource = oDataSource;
- }
- else {
- YAHOO.log("Could not instantiate AutoComplete due to an invalid DataSource", "error", this.toString());
- return;
- }
- // YAHOO.widget.DataSource schema backwards compatibility
- // Converted deprecated schema into supported schema
- // First assume key data is held in position 0 of results array
- this.key = 0;
- var schema = oDataSource.responseSchema;
- // An old school schema has been defined in the deprecated DataSource constructor
- if(oDataSource._aDeprecatedSchema) {
- var aDeprecatedSchema = oDataSource._aDeprecatedSchema;
- if(YAHOO.lang.isArray(aDeprecatedSchema)) {
-
- if((oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_JSON) ||
- (oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_UNKNOWN)) { // Used to default to unknown
- // Store the resultsList
- schema.resultsList = aDeprecatedSchema[0];
- // Store the key
- this.key = aDeprecatedSchema[1];
- // Only resultsList and key are defined, so grab all the data
- schema.fields = (aDeprecatedSchema.length < 3) ? null : aDeprecatedSchema.slice(1);
- }
- else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_XML) {
- schema.resultNode = aDeprecatedSchema[0];
- this.key = aDeprecatedSchema[1];
- schema.fields = aDeprecatedSchema.slice(1);
- }
- else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_TEXT) {
- schema.recordDelim = aDeprecatedSchema[0];
- schema.fieldDelim = aDeprecatedSchema[1];
- }
- oDataSource.responseSchema = schema;
- }
- }
-
- // Validate input element
- if(YAHOO.util.Dom.inDocument(elInput)) {
- if(YAHOO.lang.isString(elInput)) {
- this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput;
- this._elTextbox = document.getElementById(elInput);
- }
- else {
- this._sName = (elInput.id) ?
- "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput.id:
- "instance" + YAHOO.widget.AutoComplete._nIndex;
- this._elTextbox = elInput;
- }
- YAHOO.util.Dom.addClass(this._elTextbox, "yui-ac-input");
- }
- else {
- YAHOO.log("Could not instantiate AutoComplete due to an invalid input element", "error", this.toString());
- return;
- }
- // Validate container element
- if(YAHOO.util.Dom.inDocument(elContainer)) {
- if(YAHOO.lang.isString(elContainer)) {
- this._elContainer = document.getElementById(elContainer);
- }
- else {
- this._elContainer = elContainer;
- }
- if(this._elContainer.style.display == "none") {
- YAHOO.log("The container may not display properly if display is set to \"none\" in CSS", "warn", this.toString());
- }
-
- // For skinning
- var elParent = this._elContainer.parentNode;
- var elTag = elParent.tagName.toLowerCase();
- if(elTag == "div") {
- YAHOO.util.Dom.addClass(elParent, "yui-ac");
- }
- else {
- YAHOO.log("Could not find the wrapper element for skinning", "warn", this.toString());
- }
- }
- else {
- YAHOO.log("Could not instantiate AutoComplete due to an invalid container element", "error", this.toString());
- return;
- }
- // Default applyLocalFilter setting is to enable for local sources
- if(this.dataSource.dataType === YAHOO.util.DataSourceBase.TYPE_LOCAL) {
- this.applyLocalFilter = true;
- }
-
- // Set any config params passed in to override defaults
- if(oConfigs && (oConfigs.constructor == Object)) {
- for(var sConfig in oConfigs) {
- if(sConfig) {
- this[sConfig] = oConfigs[sConfig];
- }
- }
- }
- // Initialization sequence
- this._initContainerEl();
- this._initProps();
- this._initListEl();
- this._initContainerHelperEls();
- // Set up events
- var oSelf = this;
- var elTextbox = this._elTextbox;
- // Dom events
- YAHOO.util.Event.addListener(elTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);
- YAHOO.util.Event.addListener(elTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);
- YAHOO.util.Event.addListener(elTextbox,"focus",oSelf._onTextboxFocus,oSelf);
- YAHOO.util.Event.addListener(elTextbox,"blur",oSelf._onTextboxBlur,oSelf);
- YAHOO.util.Event.addListener(elContainer,"mouseover",oSelf._onContainerMouseover,oSelf);
- YAHOO.util.Event.addListener(elContainer,"mouseout",oSelf._onContainerMouseout,oSelf);
- YAHOO.util.Event.addListener(elContainer,"click",oSelf._onContainerClick,oSelf);
- YAHOO.util.Event.addListener(elContainer,"scroll",oSelf._onContainerScroll,oSelf);
- YAHOO.util.Event.addListener(elContainer,"resize",oSelf._onContainerResize,oSelf);
- YAHOO.util.Event.addListener(elTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);
- YAHOO.util.Event.addListener(window,"unload",oSelf._onWindowUnload,oSelf);
- // Custom events
- this.textboxFocusEvent = new YAHOO.util.CustomEvent("textboxFocus", this);
- this.textboxKeyEvent = new YAHOO.util.CustomEvent("textboxKey", this);
- this.dataRequestEvent = new YAHOO.util.CustomEvent("dataRequest", this);
- this.dataReturnEvent = new YAHOO.util.CustomEvent("dataReturn", this);
- this.dataErrorEvent = new YAHOO.util.CustomEvent("dataError", this);
- this.containerPopulateEvent = new YAHOO.util.CustomEvent("containerPopulate", this);
- this.containerExpandEvent = new YAHOO.util.CustomEvent("containerExpand", this);
- this.typeAheadEvent = new YAHOO.util.CustomEvent("typeAhead", this);
- this.itemMouseOverEvent = new YAHOO.util.CustomEvent("itemMouseOver", this);
- this.itemMouseOutEvent = new YAHOO.util.CustomEvent("itemMouseOut", this);
- this.itemArrowToEvent = new YAHOO.util.CustomEvent("itemArrowTo", this);
- this.itemArrowFromEvent = new YAHOO.util.CustomEvent("itemArrowFrom", this);
- this.itemSelectEvent = new YAHOO.util.CustomEvent("itemSelect", this);
- this.unmatchedItemSelectEvent = new YAHOO.util.CustomEvent("unmatchedItemSelect", this);
- this.selectionEnforceEvent = new YAHOO.util.CustomEvent("selectionEnforce", this);
- this.containerCollapseEvent = new YAHOO.util.CustomEvent("containerCollapse", this);
- this.textboxBlurEvent = new YAHOO.util.CustomEvent("textboxBlur", this);
- this.textboxChangeEvent = new YAHOO.util.CustomEvent("textboxChange", this);
-
- // Finish up
- elTextbox.setAttribute("autocomplete","off");
- YAHOO.widget.AutoComplete._nIndex++;
- YAHOO.log("AutoComplete initialized","info",this.toString());
- }
- // Required arguments were not found
- else {
- YAHOO.log("Could not instantiate AutoComplete due invalid arguments", "error", this.toString());
- }
- };
- /////////////////////////////////////////////////////////////////////////////
- //
- // Public member variables
- //
- /////////////////////////////////////////////////////////////////////////////
- /**
- * The DataSource object that encapsulates the data used for auto completion.
- * This object should be an inherited object from YAHOO.widget.DataSource.
- *
- * @property dataSource
- * @type YAHOO.widget.DataSource
- */
- YAHOO.widget.AutoComplete.prototype.dataSource = null;
- /**
- * By default, results from local DataSources will pass through the filterResults
- * method to apply a client-side matching algorithm.
- *
- * @property applyLocalFilter
- * @type Boolean
- * @default true for local arrays and json, otherwise false
- */
- YAHOO.widget.AutoComplete.prototype.applyLocalFilter = null;
- /**
- * When applyLocalFilter is true, the local filtering algorthim can have case sensitivity
- * enabled.
- *
- * @property queryMatchCase
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.queryMatchCase = false;
- /**
- * When applyLocalFilter is true, results can be locally filtered to return
- * matching strings that "contain" the query string rather than simply "start with"
- * the query string.
- *
- * @property queryMatchContains
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.queryMatchContains = false;
- /**
- * Enables query subset matching. When the DataSource's cache is enabled and queryMatchSubset is
- * true, substrings of queries will return matching cached results. For
- * instance, if the first query is for "abc" susequent queries that start with
- * "abc", like "abcd", will be queried against the cache, and not the live data
- * source. Recommended only for DataSources that return comprehensive results
- * for queries with very few characters.
- *
- * @property queryMatchSubset
- * @type Boolean
- * @default false
- *
- */
- YAHOO.widget.AutoComplete.prototype.queryMatchSubset = false;
- /**
- * Number of characters that must be entered before querying for results. A negative value
- * effectively turns off the widget. A value of 0 allows queries of null or empty string
- * values.
- *
- * @property minQueryLength
- * @type Number
- * @default 1
- */
- YAHOO.widget.AutoComplete.prototype.minQueryLength = 1;
- /**
- * Maximum number of results to display in results container.
- *
- * @property maxResultsDisplayed
- * @type Number
- * @default 10
- */
- YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed = 10;
- /**
- * Number of seconds to delay before submitting a query request. If a query
- * request is received before a previous one has completed its delay, the
- * previous request is cancelled and the new request is set to the delay. If
- * typeAhead is also enabled, this value must always be less than the typeAheadDelay
- * in order to avoid certain race conditions.
- *
- * @property queryDelay
- * @type Number
- * @default 0.2
- */
- YAHOO.widget.AutoComplete.prototype.queryDelay = 0.2;
- /**
- * If typeAhead is true, number of seconds to delay before updating input with
- * typeAhead value. In order to prevent certain race conditions, this value must
- * always be greater than the queryDelay.
- *
- * @property typeAheadDelay
- * @type Number
- * @default 0.5
- */
- YAHOO.widget.AutoComplete.prototype.typeAheadDelay = 0.5;
- /**
- * When IME usage is detected, AutoComplete will switch to querying the input
- * value at the given interval rather than per key event.
- *
- * @property queryInterval
- * @type Number
- * @default 500
- */
- YAHOO.widget.AutoComplete.prototype.queryInterval = 500;
- /**
- * Class name of a highlighted item within results container.
- *
- * @property highlightClassName
- * @type String
- * @default "yui-ac-highlight"
- */
- YAHOO.widget.AutoComplete.prototype.highlightClassName = "yui-ac-highlight";
- /**
- * Class name of a pre-highlighted item within results container.
- *
- * @property prehighlightClassName
- * @type String
- */
- YAHOO.widget.AutoComplete.prototype.prehighlightClassName = null;
- /**
- * Query delimiter. A single character separator for multiple delimited
- * selections. Multiple delimiter characteres may be defined as an array of
- * strings. A null value or empty string indicates that query results cannot
- * be delimited. This feature is not recommended if you need forceSelection to
- * be true.
- *
- * @property delimChar
- * @type String | String[]
- */
- YAHOO.widget.AutoComplete.prototype.delimChar = null;
- /**
- * Whether or not the first item in results container should be automatically highlighted
- * on expand.
- *
- * @property autoHighlight
- * @type Boolean
- * @default true
- */
- YAHOO.widget.AutoComplete.prototype.autoHighlight = true;
- /**
- * If autohighlight is enabled, whether or not the input field should be automatically updated
- * with the first query result as the user types, auto-selecting the substring portion
- * of the first result that the user has not yet typed.
- *
- * @property typeAhead
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.typeAhead = false;
- /**
- * Whether or not to animate the expansion/collapse of the results container in the
- * horizontal direction.
- *
- * @property animHoriz
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.animHoriz = false;
- /**
- * Whether or not to animate the expansion/collapse of the results container in the
- * vertical direction.
- *
- * @property animVert
- * @type Boolean
- * @default true
- */
- YAHOO.widget.AutoComplete.prototype.animVert = true;
- /**
- * Speed of container expand/collapse animation, in seconds..
- *
- * @property animSpeed
- * @type Number
- * @default 0.3
- */
- YAHOO.widget.AutoComplete.prototype.animSpeed = 0.3;
- /**
- * Whether or not to force the user's selection to match one of the query
- * results. Enabling this feature essentially transforms the input field into a
- * <select> field. This feature is not recommended with delimiter character(s)
- * defined.
- *
- * @property forceSelection
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.forceSelection = false;
- /**
- * Whether or not to allow browsers to cache user-typed input in the input
- * field. Disabling this feature will prevent the widget from setting the
- * autocomplete="off" on the input field. When autocomplete="off"
- * and users click the back button after form submission, user-typed input can
- * be prefilled by the browser from its cache. This caching of user input may
- * not be desired for sensitive data, such as credit card numbers, in which
- * case, implementers should consider setting allowBrowserAutocomplete to false.
- *
- * @property allowBrowserAutocomplete
- * @type Boolean
- * @default true
- */
- YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete = true;
- /**
- * Enabling this feature prevents the toggling of the container to a collapsed state.
- * Setting to true does not automatically trigger the opening of the container.
- * Implementers are advised to pre-load the container with an explicit "sendQuery()" call.
- *
- * @property alwaysShowContainer
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.alwaysShowContainer = false;
- /**
- * Whether or not to use an iFrame to layer over Windows form elements in
- * IE. Set to true only when the results container will be on top of a
- * <select> field in IE and thus exposed to the IE z-index bug (i.e.,
- * 5.5 < IE < 7).
- *
- * @property useIFrame
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.useIFrame = false;
- /**
- * Whether or not the results container should have a shadow.
- *
- * @property useShadow
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.useShadow = false;
- /**
- * Whether or not the input field should be updated with selections.
- *
- * @property suppressInputUpdate
- * @type Boolean
- * @default false
- */
- YAHOO.widget.AutoComplete.prototype.suppressInputUpdate = false;
- /**
- * For backward compatibility to pre-2.6.0 formatResults() signatures, setting
- * resultsTypeList to true will take each object literal result returned by
- * DataSource and flatten into an array.
- *
- * @property resultTypeList
- * @type Boolean
- * @default true
- */
- YAHOO.widget.AutoComplete.prototype.resultTypeList = true;
- /**
- * For XHR DataSources, AutoComplete will automatically insert a "?" between the server URI and
- * the "query" param/value pair. To prevent this behavior, implementers should
- * set this value to false. To more fully customize the query syntax, implementers
- * should override the generateRequest() method.
- *
- * @property queryQuestionMark
- * @type Boolean
- * @default true
- */
- YAHOO.widget.AutoComplete.prototype.queryQuestionMark = true;
- /////////////////////////////////////////////////////////////////////////////
- //
- // Public methods
- //
- /////////////////////////////////////////////////////////////////////////////
- /**
- * Public accessor to the unique name of the AutoComplete instance.
- *
- * @method toString
- * @return {String} Unique name of the AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.toString = function() {
- return "AutoComplete " + this._sName;
- };
- /**
- * Returns DOM reference to input element.
- *
- * @method getInputEl
- * @return {HTMLELement} DOM reference to input element.
- */
- YAHOO.widget.AutoComplete.prototype.getInputEl = function() {
- return this._elTextbox;
- };
- /**
- * Returns DOM reference to container element.
- *
- * @method getContainerEl
- * @return {HTMLELement} DOM reference to container element.
- */
- YAHOO.widget.AutoComplete.prototype.getContainerEl = function() {
- return this._elContainer;
- };
- /**
- * Returns true if widget instance is currently focused.
- *
- * @method isFocused
- * @return {Boolean} Returns true if widget instance is currently focused.
- */
- YAHOO.widget.AutoComplete.prototype.isFocused = function() {
- return (this._bFocused === null) ? false : this._bFocused;
- };
- /**
- * Returns true if container is in an expanded state, false otherwise.
- *
- * @method isContainerOpen
- * @return {Boolean} Returns true if container is in an expanded state, false otherwise.
- */
- YAHOO.widget.AutoComplete.prototype.isContainerOpen = function() {
- return this._bContainerOpen;
- };
- /**
- * Public accessor to the <ul> element that displays query results within the results container.
- *
- * @method getListEl
- * @return {HTMLElement[]} Reference to <ul> element within the results container.
- */
- YAHOO.widget.AutoComplete.prototype.getListEl = function() {
- return this._elList;
- };
- /**
- * Public accessor to the matching string associated with a given <li> result.
- *
- * @method getListItemMatch
- * @param elListItem {HTMLElement} Reference to <LI> element.
- * @return {String} Matching string.
- */
- YAHOO.widget.AutoComplete.prototype.getListItemMatch = function(elListItem) {
- if(elListItem._sResultMatch) {
- return elListItem._sResultMatch;
- }
- else {
- return null;
- }
- };
- /**
- * Public accessor to the result data associated with a given <li> result.
- *
- * @method getListItemData
- * @param elListItem {HTMLElement} Reference to <LI> element.
- * @return {Object} Result data.
- */
- YAHOO.widget.AutoComplete.prototype.getListItemData = function(elListItem) {
- if(elListItem._oResultData) {
- return elListItem._oResultData;
- }
- else {
- return null;
- }
- };
- /**
- * Public accessor to the index of the associated with a given <li> result.
- *
- * @method getListItemIndex
- * @param elListItem {HTMLElement} Reference to <LI> element.
- * @return {Number} Index.
- */
- YAHOO.widget.AutoComplete.prototype.getListItemIndex = function(elListItem) {
- if(YAHOO.lang.isNumber(elListItem._nItemIndex)) {
- return elListItem._nItemIndex;
- }
- else {
- return null;
- }
- };
- /**
- * Sets HTML markup for the results container header. This markup will be
- * inserted within a <div> tag with a class of "yui-ac-hd".
- *
- * @method setHeader
- * @param sHeader {String} HTML markup for results container header.
- */
- YAHOO.widget.AutoComplete.prototype.setHeader = function(sHeader) {
- if(this._elHeader) {
- var elHeader = this._elHeader;
- if(sHeader) {
- elHeader.innerHTML = sHeader;
- elHeader.style.display = "block";
- }
- else {
- elHeader.innerHTML = "";
- elHeader.style.display = "none";
- }
- }
- };
- /**
- * Sets HTML markup for the results container footer. This markup will be
- * inserted within a <div> tag with a class of "yui-ac-ft".
- *
- * @method setFooter
- * @param sFooter {String} HTML markup for results container footer.
- */
- YAHOO.widget.AutoComplete.prototype.setFooter = function(sFooter) {
- if(this._elFooter) {
- var elFooter = this._elFooter;
- if(sFooter) {
- elFooter.innerHTML = sFooter;
- elFooter.style.display = "block";
- }
- else {
- elFooter.innerHTML = "";
- elFooter.style.display = "none";
- }
- }
- };
- /**
- * Sets HTML markup for the results container body. This markup will be
- * inserted within a <div> tag with a class of "yui-ac-bd".
- *
- * @method setBody
- * @param sBody {String} HTML markup for results container body.
- */
- YAHOO.widget.AutoComplete.prototype.setBody = function(sBody) {
- if(this._elBody) {
- var elBody = this._elBody;
- YAHOO.util.Event.purgeElement(elBody, true);
- if(sBody) {
- elBody.innerHTML = sBody;
- elBody.style.display = "block";
- }
- else {
- elBody.innerHTML = "";
- elBody.style.display = "none";
- }
- this._elList = null;
- }
- };
- /**
- * A function that converts an AutoComplete query into a request value which is then
- * passed to the DataSource's sendRequest method in order to retrieve data for
- * the query. By default, returns a String with the syntax: "query={query}"
- * Implementers can customize this method for custom request syntaxes.
- *
- * @method generateRequest
- * @param sQuery {String} Query string
- * @return {MIXED} Request
- */
- YAHOO.widget.AutoComplete.prototype.generateRequest = function(sQuery) {
- var dataType = this.dataSource.dataType;
-
- // Transform query string in to a request for remote data
- // By default, local data doesn't need a transformation, just passes along the query as is.
- if(dataType === YAHOO.util.DataSourceBase.TYPE_XHR) {
- // By default, XHR GET requests look like "{scriptURI}?{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
- if(!this.dataSource.connMethodPost) {
- sQuery = (this.queryQuestionMark ? "?" : "") + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
- (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
- }
- // By default, XHR POST bodies are sent to the {scriptURI} like "{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
- else {
- sQuery = (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
- (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
- }
- }
- // By default, remote script node requests look like "{scriptURI}&{scriptCallbackParam}={callbackString}&{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
- else if(dataType === YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE) {
- sQuery = "&" + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
- (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
- }
-
- return sQuery;
- };
- /**
- * Makes query request to the DataSource.
- *
- * @method sendQuery
- * @param sQuery {String} Query string.
- */
- YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) {
- // Reset focus for a new interaction
- this._bFocused = null;
-
- // Adjust programatically sent queries to look like they were input by user
- // when delimiters are enabled
- var newQuery = (this.delimChar) ? this._elTextbox.value + sQuery : sQuery;
- this._sendQuery(newQuery);
- };
- /**
- * Collapses container.
- *
- * @method collapseContainer
- */
- YAHOO.widget.AutoComplete.prototype.collapseContainer = function() {
- this._toggleContainer(false);
- };
- /**
- * Handles subset matching for when queryMatchSubset is enabled.
- *
- * @method getSubsetMatches
- * @param sQuery {String} Query string.
- * @return {Object} oParsedResponse or null.
- */
- YAHOO.widget.AutoComplete.prototype.getSubsetMatches = function(sQuery) {
- var subQuery, oCachedResponse, subRequest;
- // Loop through substrings of each cached element's query property...
- for(var i = sQuery.length; i >= this.minQueryLength ; i--) {
- subRequest = this.generateRequest(sQuery.substr(0,i));
- this.dataRequestEvent.fire(this, subQuery, subRequest);
- YAHOO.log("Searching for query subset \"" + subQuery + "\" in cache", "info", this.toString());
-
- // If a substring of the query is found in the cache
- oCachedResponse = this.dataSource.getCachedResponse(subRequest);
- if(oCachedResponse) {
- YAHOO.log("Found match for query subset \"" + subQuery + "\": " + YAHOO.lang.dump(oCachedResponse), "info", this.toString());
- return this.filterResults.apply(this.dataSource, [sQuery, oCachedResponse, oCachedResponse, {scope:this}]);
- }
- }
- YAHOO.log("Did not find subset match for query subset \"" + sQuery + "\"" , "info", this.toString());
- return null;
- };
- /**
- * Executed by DataSource (within DataSource scope via doBeforeParseData()) to
- * handle responseStripAfter cleanup.
- *
- * @method preparseRawResponse
- * @param sQuery {String} Query string.
- * @return {Object} oParsedResponse or null.
- */
- YAHOO.widget.AutoComplete.prototype.preparseRawResponse = function(oRequest, oFullResponse, oCallback) {
- var nEnd = ((this.responseStripAfter !== "") && (oFullResponse.indexOf)) ?
- oFullResponse.indexOf(this.responseStripAfter) : -1;
- if(nEnd != -1) {
- oFullResponse = oFullResponse.substring(0,nEnd);
- }
- return oFullResponse;
- };
- /**
- * Executed by DataSource (within DataSource scope via doBeforeCallback()) to
- * filter results through a simple client-side matching algorithm.
- *
- * @method filterResults
- * @param sQuery {String} Original request.
- * @param oFullResponse {Object} Full response object.
- * @param oParsedResponse {Object} Parsed response object.
- * @param oCallback {Object} Callback object.
- * @return {Object} Filtered response object.
- */
- YAHOO.widget.AutoComplete.prototype.filterResults = function(sQuery, oFullResponse, oParsedResponse, oCallback) {
- // If AC has passed a query string value back to itself, grab it
- if(oCallback && oCallback.argument && oCallback.argument.query) {
- sQuery = oCallback.argument.query;
- }
- // Only if a query string is available to match against
- if(sQuery && sQuery !== "") {
- // First make a copy of the oParseResponse
- oParsedResponse = YAHOO.widget.AutoComplete._cloneObject(oParsedResponse);
-
- var oAC = oCallback.scope,
- oDS = this,
- allResults = oParsedResponse.results, // the array of results
- filteredResults = [], // container for filtered results
- bMatchFound = false,
- bMatchCase = (oDS.queryMatchCase || oAC.queryMatchCase), // backward compat
- bMatchContains = (oDS.queryMatchContains || oAC.queryMatchContains); // backward compat
-
- // Loop through each result object...
- for(var i = allResults.length-1; i >= 0; i--) {
- var oResult = allResults[i];
- // Grab the data to match against from the result object...
- var sResult = null;
-
- // Result object is a simple string already
- if(YAHOO.lang.isString(oResult)) {
- sResult = oResult;
- }
- // Result object is an array of strings
- else if(YAHOO.lang.isArray(oResult)) {
- sResult = oResult[0];
-
- }
- // Result object is an object literal of strings
- else if(this.responseSchema.fields) {
- var key = this.responseSchema.fields[0].key || this.responseSchema.fields[0];
- sResult = oResult[key];
- }
- // Backwards compatibility
- else if(this.key) {
- sResult = oResult[this.key];
- }
-
- if(YAHOO.lang.isString(sResult)) {
-
- var sKeyIndex = (bMatchCase) ?
- sResult.indexOf(decodeURIComponent(sQuery)) :
- sResult.toLowerCase().indexOf(decodeURIComponent(sQuery).toLowerCase());
- // A STARTSWITH match is when the query is found at the beginning of the key string...
- if((!bMatchContains && (sKeyIndex === 0)) ||
- // A CONTAINS match is when the query is found anywhere within the key string...
- (bMatchContains && (sKeyIndex > -1))) {
- // Stash the match
- filteredResults.unshift(oResult);
- }
- }
- }
- oParsedResponse.results = filteredResults;
- YAHOO.log("Filtered " + filteredResults.length + " results against query \"" + sQuery + "\": " + YAHOO.lang.dump(filteredResults), "info", this.toString());
- }
- else {
- YAHOO.log("Did not filter results against query", "info", this.toString());
- }
-
- return oParsedResponse;
- };
- /**
- * Handles response for display. This is the callback function method passed to
- * YAHOO.util.DataSourceBase#sendRequest so results from the DataSource are
- * returned to the AutoComplete instance.
- *
- * @method handleResponse
- * @param sQuery {String} Original request.
- * @param oResponse {Object} Response object.
- * @param oPayload {MIXED} (optional) Additional argument(s)
- */
- YAHOO.widget.AutoComplete.prototype.handleResponse = function(sQuery, oResponse, oPayload) {
- if((this instanceof YAHOO.widget.AutoComplete) && this._sName) {
- this._populateList(sQuery, oResponse, oPayload);
- }
- };
- /**
- * Overridable method called before container is loaded with result data.
- *
- * @method doBeforeLoadData
- * @param sQuery {String} Original request.
- * @param oResponse {Object} Response object.
- * @param oPayload {MIXED} (optional) Additional argument(s)
- * @return {Boolean} Return true to continue loading data, false to cancel.
- */
- YAHOO.widget.AutoComplete.prototype.doBeforeLoadData = function(sQuery, oResponse, oPayload) {
- return true;
- };
- /**
- * Overridable method that returns HTML markup for one result to be populated
- * as innerHTML of an <LI> element.
- *
- * @method formatResult
- * @param oResultData {Object} Result data object.
- * @param sQuery {String} The corresponding query string.
- * @param sResultMatch {HTMLElement} The current query string.
- * @return {String} HTML markup of formatted result data.
- */
- YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultData, sQuery, sResultMatch) {
- var sMarkup = (sResultMatch) ? sResultMatch : "";
- return sMarkup;
- };
- /**
- * Overridable method called before container expands allows implementers to access data
- * and DOM elements.
- *
- * @method doBeforeExpandContainer
- * @param elTextbox {HTMLElement} The text input box.
- * @param elContainer {HTMLElement} The container element.
- * @param sQuery {String} The query string.
- * @param aResults {Object[]} An array of query results.
- * @return {Boolean} Return true to continue expanding container, false to cancel the expand.
- */
- YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer = function(elTextbox, elContainer, sQuery, aResults) {
- return true;
- };
- /**
- * Nulls out the entire AutoComplete instance and related objects, removes attached
- * event listeners, and clears out DOM elements inside the container. After
- * calling this method, the instance reference should be expliclitly nulled by
- * implementer, as in myAutoComplete = null. Use with caution!
- *
- * @method destroy
- */
- YAHOO.widget.AutoComplete.prototype.destroy = function() {
- var instanceName = this.toString();
- var elInput = this._elTextbox;
- var elContainer = this._elContainer;
- // Unhook custom events
- this.textboxFocusEvent.unsubscribeAll();
- this.textboxKeyEvent.unsubscribeAll();
- this.dataRequestEvent.unsubscribeAll();
- this.dataReturnEvent.unsubscribeAll();
- this.dataErrorEvent.unsubscribeAll();
- this.containerPopulateEvent.unsubscribeAll();
- this.containerExpandEvent.unsubscribeAll();
- this.typeAheadEvent.unsubscribeAll();
- this.itemMouseOverEvent.unsubscribeAll();
- this.itemMouseOutEvent.unsubscribeAll();
- this.itemArrowToEvent.unsubscribeAll();
- this.itemArrowFromEvent.unsubscribeAll();
- this.itemSelectEvent.unsubscribeAll();
- this.unmatchedItemSelectEvent.unsubscribeAll();
- this.selectionEnforceEvent.unsubscribeAll();
- this.containerCollapseEvent.unsubscribeAll();
- this.textboxBlurEvent.unsubscribeAll();
- this.textboxChangeEvent.unsubscribeAll();
- // Unhook DOM events
- YAHOO.util.Event.purgeElement(elInput, true);
- YAHOO.util.Event.purgeElement(elContainer, true);
- // Remove DOM elements
- elContainer.innerHTML = "";
- // Null out objects
- for(var key in this) {
- if(YAHOO.lang.hasOwnProperty(this, key)) {
- this[key] = null;
- }
- }
- YAHOO.log("AutoComplete instance destroyed: " + instanceName);
- };
- /////////////////////////////////////////////////////////////////////////////
- //
- // Public events
- //
- /////////////////////////////////////////////////////////////////////////////
- /**
- * Fired when the input field receives focus.
- *
- * @event textboxFocusEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.textboxFocusEvent = null;
- /**
- * Fired when the input field receives key input.
- *
- * @event textboxKeyEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param nKeycode {Number} The keycode number.
- */
- YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null;
- /**
- * Fired when the AutoComplete instance makes a request to the DataSource.
- *
- * @event dataRequestEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param sQuery {String} The query string.
- * @param oRequest {Object} The request.
- */
- YAHOO.widget.AutoComplete.prototype.dataRequestEvent = null;
- /**
- * Fired when the AutoComplete instance receives query results from the data
- * source.
- *
- * @event dataReturnEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param sQuery {String} The query string.
- * @param aResults {Object[]} Results array.
- */
- YAHOO.widget.AutoComplete.prototype.dataReturnEvent = null;
- /**
- * Fired when the AutoComplete instance does not receive query results from the
- * DataSource due to an error.
- *
- * @event dataErrorEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param sQuery {String} The query string.
- */
- YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null;
- /**
- * Fired when the results container is populated.
- *
- * @event containerPopulateEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.containerPopulateEvent = null;
- /**
- * Fired when the results container is expanded.
- *
- * @event containerExpandEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null;
- /**
- * Fired when the input field has been prefilled by the type-ahead
- * feature.
- *
- * @event typeAheadEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param sQuery {String} The query string.
- * @param sPrefill {String} The prefill string.
- */
- YAHOO.widget.AutoComplete.prototype.typeAheadEvent = null;
- /**
- * Fired when result item has been moused over.
- *
- * @event itemMouseOverEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param elItem {HTMLElement} The <li> element item moused to.
- */
- YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null;
- /**
- * Fired when result item has been moused out.
- *
- * @event itemMouseOutEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param elItem {HTMLElement} The <li> element item moused from.
- */
- YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null;
- /**
- * Fired when result item has been arrowed to.
- *
- * @event itemArrowToEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param elItem {HTMLElement} The <li> element item arrowed to.
- */
- YAHOO.widget.AutoComplete.prototype.itemArrowToEvent = null;
- /**
- * Fired when result item has been arrowed away from.
- *
- * @event itemArrowFromEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param elItem {HTMLElement} The <li> element item arrowed from.
- */
- YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent = null;
- /**
- * Fired when an item is selected via mouse click, ENTER key, or TAB key.
- *
- * @event itemSelectEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param elItem {HTMLElement} The selected <li> element item.
- * @param oData {Object} The data returned for the item, either as an object,
- * or mapped from the schema into an array.
- */
- YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null;
- /**
- * Fired when a user selection does not match any of the displayed result items.
- *
- * @event unmatchedItemSelectEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param sSelection {String} The selected string.
- */
- YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent = null;
- /**
- * Fired if forceSelection is enabled and the user's input has been cleared
- * because it did not match one of the returned query results.
- *
- * @event selectionEnforceEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- * @param sClearedValue {String} The cleared value (including delimiters if applicable).
- */
- YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent = null;
- /**
- * Fired when the results container is collapsed.
- *
- * @event containerCollapseEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.containerCollapseEvent = null;
- /**
- * Fired when the input field loses focus.
- *
- * @event textboxBlurEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.textboxBlurEvent = null;
- /**
- * Fired when the input field value has changed when it loses focus.
- *
- * @event textboxChangeEvent
- * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
- */
- YAHOO.widget.AutoComplete.prototype.textboxChangeEvent = null;
- /////////////////////////////////////////////////////////////////////////////
- //
- // Private member variables
- //
- /////////////////////////////////////////////////////////////////////////////
- /**
- * Internal class variable to index multiple AutoComplete instances.
- *
- * @property _nIndex
- * @type Number
- * @default 0
- * @private
- */
- YAHOO.widget.AutoComplete._nIndex = 0;
- /**
- * Name of AutoComplete instance.
- *
- * @property _sName
- * @type String
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._sName = null;
- /**
- * Text input field DOM element.
- *
- * @property _elTextbox
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elTextbox = null;
- /**
- * Container DOM element.
- *
- * @property _elContainer
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elContainer = null;
- /**
- * Reference to content element within container element.
- *
- * @property _elContent
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elContent = null;
- /**
- * Reference to header element within content element.
- *
- * @property _elHeader
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elHeader = null;
- /**
- * Reference to body element within content element.
- *
- * @property _elBody
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elBody = null;
- /**
- * Reference to footer element within content element.
- *
- * @property _elFooter
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elFooter = null;
- /**
- * Reference to shadow element within container element.
- *
- * @property _elShadow
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elShadow = null;
- /**
- * Reference to iframe element within container element.
- *
- * @property _elIFrame
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elIFrame = null;
- /**
- * Whether or not the input field is currently in focus. If query results come back
- * but the user has already moved on, do not proceed with auto complete behavior.
- *
- * @property _bFocused
- * @type Boolean
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._bFocused = null;
- /**
- * Animation instance for container expand/collapse.
- *
- * @property _oAnim
- * @type Boolean
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._oAnim = null;
- /**
- * Whether or not the results container is currently open.
- *
- * @property _bContainerOpen
- * @type Boolean
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._bContainerOpen = false;
- /**
- * Whether or not the mouse is currently over the results
- * container. This is necessary in order to prevent clicks on container items
- * from being text input field blur events.
- *
- * @property _bOverContainer
- * @type Boolean
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._bOverContainer = false;
- /**
- * Internal reference to <ul> elements that contains query results within the
- * results container.
- *
- * @property _elList
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elList = null;
- /*
- * Array of <li> elements references that contain query results within the
- * results container.
- *
- * @property _aListItemEls
- * @type HTMLElement[]
- * @private
- */
- //YAHOO.widget.AutoComplete.prototype._aListItemEls = null;
- /**
- * Number of <li> elements currently displayed in results container.
- *
- * @property _nDisplayedItems
- * @type Number
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0;
- /*
- * Internal count of <li> elements displayed and hidden in results container.
- *
- * @property _maxResultsDisplayed
- * @type Number
- * @private
- */
- //YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed = 0;
- /**
- * Current query string
- *
- * @property _sCurQuery
- * @type String
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._sCurQuery = null;
- /**
- * Selections from previous queries (for saving delimited queries).
- *
- * @property _sPastSelections
- * @type String
- * @default ""
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._sPastSelections = "";
- /**
- * Stores initial input value used to determine if textboxChangeEvent should be fired.
- *
- * @property _sInitInputValue
- * @type String
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._sInitInputValue = null;
- /**
- * Pointer to the currently highlighted <li> element in the container.
- *
- * @property _elCurListItem
- * @type HTMLElement
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._elCurListItem = null;
- /**
- * Whether or not an item has been selected since the container was populated
- * with results. Reset to false by _populateList, and set to true when item is
- * selected.
- *
- * @property _bItemSelected
- * @type Boolean
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._bItemSelected = false;
- /**
- * Key code of the last key pressed in textbox.
- *
- * @property _nKeyCode
- * @type Number
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._nKeyCode = null;
- /**
- * Delay timeout ID.
- *
- * @property _nDelayID
- * @type Number
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._nDelayID = -1;
- /**
- * TypeAhead delay timeout ID.
- *
- * @property _nTypeAheadDelayID
- * @type Number
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID = -1;
- /**
- * Src to iFrame used when useIFrame = true. Supports implementations over SSL
- * as well.
- *
- * @property _iFrameSrc
- * @type String
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._iFrameSrc = "javascript:false;";
- /**
- * For users typing via certain IMEs, queries must be triggered by intervals,
- * since key events yet supported across all browsers for all IMEs.
- *
- * @property _queryInterval
- * @type Object
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._queryInterval = null;
- /**
- * Internal tracker to last known textbox value, used to determine whether or not
- * to trigger a query via interval for certain IME users.
- *
- * @event _sLastTextboxValue
- * @type String
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._sLastTextboxValue = null;
- /////////////////////////////////////////////////////////////////////////////
- //
- // Private methods
- //
- /////////////////////////////////////////////////////////////////////////////
- /**
- * Updates and validates latest public config properties.
- *
- * @method __initProps
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._initProps = function() {
- // Correct any invalid values
- var minQueryLength = this.minQueryLength;
- if(!YAHOO.lang.isNumber(minQueryLength)) {
- this.minQueryLength = 1;
- }
- var maxResultsDisplayed = this.maxResultsDisplayed;
- if(!YAHOO.lang.isNumber(maxResultsDisplayed) || (maxResultsDisplayed < 1)) {
- this.maxResultsDisplayed = 10;
- }
- var queryDelay = this.queryDelay;
- if(!YAHOO.lang.isNumber(queryDelay) || (queryDelay < 0)) {
- this.queryDelay = 0.2;
- }
- var typeAheadDelay = this.typeAheadDelay;
- if(!YAHOO.lang.isNumber(typeAheadDelay) || (typeAheadDelay < 0)) {
- this.typeAheadDelay = 0.2;
- }
- var delimChar = this.delimChar;
- if(YAHOO.lang.isString(delimChar) && (delimChar.length > 0)) {
- this.delimChar = [delimChar];
- }
- else if(!YAHOO.lang.isArray(delimChar)) {
- this.delimChar = null;
- }
- var animSpeed = this.animSpeed;
- if((this.animHoriz || this.animVert) && YAHOO.util.Anim) {
- if(!YAHOO.lang.isNumber(animSpeed) || (animSpeed < 0)) {
- this.animSpeed = 0.3;
- }
- if(!this._oAnim ) {
- this._oAnim = new YAHOO.util.Anim(this._elContent, {}, this.animSpeed);
- }
- else {
- this._oAnim.duration = this.animSpeed;
- }
- }
- if(this.forceSelection && delimChar) {
- YAHOO.log("The forceSelection feature has been enabled with delimChar defined.","warn", this.toString());
- }
- };
- /**
- * Initializes the results container helpers if they are enabled and do
- * not exist
- *
- * @method _initContainerHelperEls
- * @private
- */
- YAHOO.widget.AutoComplete.prototype._initContainerHelperEls = function() {
- if(this.useShadow && !this._elShadow) {
- var elShadow = document.createElement("div");
- elShadow.className = "yui-ac-shadow";
- elShadow.style.width = 0;
- elShadow.style.height = 0;
- this._elShadow = this._elContainer.appendChild(elShadow);
- }
- if(this.useIFrame && !this._elIFrame) {
- var elIFrame = document.createElement("iframe");
- elIFrame.src = this._iFrameSrc;
- elIFrame.fra…
Large files files are truncated, but you can click here to view the full file