Skip to content

Instantly share code, notes, and snippets.

@zhephree
zhephree / your.css
Created August 17, 2011 05:02
AutoComplete in webOS Enyo
/*
The CSS is pretty basic. The important part is to make sure your holder DIV has the exact same font family
and font size as your Input. We can't /actually/ calculate the width of a font, so we cheat. We do this by
copying whatever text is in the Input into a hidden DIV. That Div is set to expand its width as the content
changes. We can then guess about how wide the block of text is. I set a max-width on the DIV so that it won't
push the suggestions list too far off the screen, even though we account for that in the keypress function.
*/
.holder {
var event = new Event('build');
// Listen for the event.
elem.addEventListener('build', function (e) { ... }, false);
// Dispatch the event.
elem.dispatchEvent(event);