The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

thartdyke (6) [Avatar] Offline
#1
I've been tearing my hair out for the last few days trying to get the typeahead suggest example to work properly in Firefox (1.5.0.4 Windows). The following section from listing 10.14 was causing errors:

...
xPosElement.style.left = selectedPosX';
if(theTextBoxInt.obj.matchTextBoxWidth)
xPosElement.style.width = theElemWidth;
xPosElement.style.top = selectedPosY + theElemHeight;
... etc.

The assignments for .left, .width and .top would fail, causing error reports in the Javascript console, and the drop down would be positioned at the top left of the screen.

It turns out Firefox (at least my version) insists on units. The following fixed my problem:

xPosElement.style.left = selectedPosX + 'px';
if(theTextBoxInt.obj.matchTextBoxWidth)
xPosElement.style.width = theElemWidth + 'px';
xPosElement.style.top = selectedPosY + theElemHeight + 'px';

IE and Opera seem to be happy with either, but I would think that having the units would be more 'standards compliant', hence Firefox's fussiness.

Toby
Pascarello (208) [Avatar] Offline
#2
Re: Typeahead CSS in Firefox
Yes you are right, Firefox needs the units. I willl add that to the Errata.

Eric