Fixed Problem with xenforos autoselect function and long texts

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
If you have a very long text in a inputfield with the autoselect class, chrome won't select the text and firefox will crash:D
In the js console you'll see

Uncaught RangeError: Maximum call stack size exceeded
my inputfield value was
Code:
keywords=test23&title_only=0&date=0&users=&child_nodes=0&user_content=&order=date&group_discussion=0&type=



It's probably this jquery bug: http://bugs.jquery.com/ticket/10476


My fix was to change the focus event with click

Code:
XenForo.AutoSelect = function($input)
{
$input.bind('focus', function(e)
{
$input.focus().select();
console.log('input select');
return false;
});
};
 

Attachments

The downside to that is if the user tabs in to the input then it won't run the function because it's no longer using the focus event. Upgrading xF jQuery to 1.7.2 would be nice.
I agree, but where do you use the AutoSelect? IMO not in forms (where you use tabs).. Instead it's "most" used in "input fields" where users can copy the text ..

E.g.
form.webp

ssu.webp

So it would be at least a quick fix, before they want to upgrade the jquery version^^
 
I actually use it within an add on within a form to auto select. That said, I would agree that it isn't heavily used in that application and the more likely use case is the one you point out in your second attachment.
 
It doesn't look like a jQuery bug to me. We were calling focus() within a focus event, so it was triggering an infinite loop. Sorted now though.
 
Top Bottom