Using templateResult on a select with a lot of options

I’m trying to customize the options using templateResult on a select with 484 options. I have a condition in my callback function to compare the text property to a value to stylize only certain options, my problem is that when I debug the callback function, the text property always returns the value “Searching…” and never the actual value.

In the example below, option.text always equals “Searching…” when I debug the condition with a breakpoint. Any ideas?

function formatUnit(option) {
var $option = ‘’;
if (option.text == “some text”) {
$option = $(’’ + option.text + ‘’);
} else {
$option = $(’’ + option.text + ‘’);
}
return $option;
}

Where are the options coming from? AJAX, a JavaScript array, or static HTML option elements?