Ticket #2529982 (closed defect)


Opened: 02/22/11
Last modified: 06/5/12
Status: closed
Type: defect
Resolution: duplicate
Duplicate of: #2532268


Dav Glass
Target Release:
Priority: P3 (normal)
Summary: autocomplete error trying to load intl

Hi, first of all, thank you @yaypie for this wonderful widget!
We have a strange problem loading the autocomplete rollup; perhaps this must be filed against che "loader" component, but we cannot identify correctly the matter here.
We also apologize not being able to attach publicly the js files involved; the environment is a corporate one, but if you need them, drop us an email and we'll sent you immediately.
Long story short: we have a website in which you change page in an ajax-y way: clicking on the fixed menu link make the content disappear, and new content is pulled in. If we have an autocomplete both
on the previous and the next page, the second autocomplete throw an error, "Y.Intl.get is not a function", on line 2667 of autocomplete.js:

strings: {
valueFn: function () {
return Y.Intl.get('autocomplete-list');

Few more details:
- with Firebug we are able to see that in this call Y.Intl is an object with only a property, "lookupBestLang" (doesn't have "get" or everything else)
- autocomplete configuration: we try to simplify everything trying to catch this bug, so if you set only the parameters in the documentation "basic example with local data", bug will happen
- page load: all our content is wrapped in a div, say div="container". At every "page load" we do (this is a simplified version, for clarity's sake):

Y.Event.purgeElement("#container", true);
Y.one("#container").set('innerHTML', "HTML-FROM-SERVER-SIDE");
setTimeout('JS-FROM-SERVER-SIDE', 0);

- for every page we have a YUI3 module, say:

YUI.add('module1', function(Y) {
Y.one('#myinput').plug(Y.Plugin.AutoComplete, {
source: YUI.mynamespace.getList(),
maxResults: 5,
minQueryLength: 1,
queryDelay: 50,
resultFilters: [YUI.mynamespace.filterListResults],
resultFormatter: formatResultList,
resultTextLocator: function (result) {
return result.venditrice;//+' '+result.descrizione;
}, '1.0', {requires: ['node', 'json', 'selector-css3', 'io', 'querystring', 'autocomplete', 'collection']});

- We use a common YUI_config object shared across Y instances
- for our modules we don't list the dependencies, because we handle them dynamically with the "groups" configuration, composing the path on the fly with some regexp
- if we explicitely add (just trying), in the module requirements list above, the intl module along with autocomplete rollup, the autocomplete loads correctly but when selecting an element there's
another error "s is undefined" from yui.js on line 1847:

L.sub = function(s, o) {
return ((s.replace) ? s.replace(SUBREGEX, function(match, key) {
return (!L.isUndefined(o[key])) ? o[key] : match;
}) : s);

Thank you for your time.
If this bug will be fixed in a git commit, may you explicitely link it with this ticket? This bug prevent us to deploy more than one instance of this widget...and we really need it!!

Type: defect Observed in Version: 3.3.0
Component: Loader Severity: S3 (normal)
Assigned To: Dav Glass Target Release:
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: All
Test Information:


Attachment #1: yui-testcase-3.5.1.zip (download)
Attachment #2: yui-testcase.zip (download)

Change History

Ryan Grove

YUI Developer

  • Username: rgrove
  • GitHub: rgrove
Posted: 02/22/11
  • priority changed to P3 (normal)
  • status changed from new to infoneeded

If possible, could you please provide a reduced test case that demonstrates the problem? I'm also CCing Adam in case this rings any bells.

Adam Moore

YUI Contributor

  • Username: adam
  • GitHub: apm
Posted: 02/22/11

Auto-loading the intl package currently requires the loader... if you are not using loader, you should add intl to the requirements list for your custom module.


  • Username: matteo
Posted: 03/1/11
  • status changed from infoneeded to assigned

Hi Ryan, I've just attached a testcase as requested (@adam: we are using the loader, as you can see).
The "good news" is that the bug has 100% reproducibility; the bad one is that, even if I've tried to strip everything that doesn't matter, there's too code anyway..sorry about it.
I've renamed all components, cut out a lot of code, stripped our internal names and corporate references, but the global structure is the same we use: the only difference is that in template.js, the "load" function does a real Y.io call (as per comment), but I think all would be the same.
Opening index.html, if you click on "Autocomplete 1" or "Autocomplete 2", only ONE time, all is fine and the widget is populated.
BUT if you click on "Autocomplete 1" and then "Autocomplete 2" (you can obviously reverse the order), you will see "Y.Intl.get is not a function", and the second autocomplete will not load.
I'd like to say that this system is widely deployed since half of 2010, and we're using a lot of YUI3 in this way (I can give you other details if you want), so if you see something nasty, it's probably due to my ugly cut'n paste.
We were doing a global YUI3 autocomplete transition, and you can imagine that this bug is really blocking for us all: so, I'll do whatever is needed to solve this issue sooner than later: let me know if we can help in some way.
Thank you in advance.

Ryan Grove

YUI Developer

  • Username: rgrove
  • GitHub: rgrove
Posted: 03/1/11
  • component changed from AutoComplete to Loader
  • owner changed from Ryan Grove to Adam Moore

I'd guess this is something to do with the groups config, but I'm no expert on that. In any case, when I added 'intl' to the YUI().use() call on line 99 of template.js, the problem went away.

Adam, I'm passing this to you to determine whether this behavior is expected or a bug.


  • Username: matteo
Posted: 03/2/11

Ryan, thank you for your quick response: we'll wait for Adam, but for completeness: the immediate error disappears when "adding 'intl' to the YUI().use() call" as you suggested, but everything you do with autocomplete from now on throws an error: for example, if you select an item, you will see the error I listed above in the ticket description: 's is undefined', using Y.Lang.Sub (I think).


YUI Developer

  • Username: george
Posted: 04/20/11
  • owner changed from Adam Moore to Dav Glass

Dav Glass

Posted: 04/26/11
  • location changed to Library Code
  • milestone changed to 3.NEXT
  • status changed from assigned to accepted


  • Username: matteo
Posted: 05/12/11

Hi all, do you have any plans about solving this for 3.4.0?
This will help a lot our short/mid-term issues and todo lists..
We'd be glad to help you: can you point our debug somewhere? It's difficult to navigate in the deep loader space :)
Thank you in advance

Dav Glass

Posted: 05/26/11
  • milestone changed from 3.NEXT to 3.4.0

Dav Glass

Posted: 06/9/11
  • completed changed from 0 to 0.75
  • remaining changed from 0.5 to 0
  • status changed from accepted to checkedin


YUI Developer

  • Username: george
Posted: 08/18/11
  • resolution changed to fixed
  • status changed from checkedin to closed

Francesco Pongiluppi

YUI Contributor

Posted: 06/5/12
  • milestone changed from 3.4.0
  • resolution changed from fixed
  • status changed from closed to reopened

This is solved in 3.4.0, but not in 3.5.1; we uploaded the test case against YUI-3.5.1 and it fails with the same error.

Dav Glass

Posted: 06/5/12
  • duplicate changed to 2532268
  • resolution changed to duplicate
  • status changed from reopened to closed

This ticket was marked as a duplicate of #2532268