This week I had a joy of spending several hours trying to solve and intermitently happening bug. In short, some 2 times out of 3 the YUI selector utility failed to lookup elements in an XHR loaded HTML fragment. After digging quite deep into the YUI code, I found that it was actually the fault of the way ASP.NET MVC treats partial views.
- ASP.NET MVC allows use of ASCX as “partial views”
- It correctly assumes, that uniqueness of ClientID should be preserved
- It incorrectly does not prepend an alpha-character to automatically generated GUID based IDs
- User agents and selector libraries may correctly ignore such invalid IDs
- Solution: override