• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Problem with xenforos autoselect function and long texts

R

ragtek

Guest
#1
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

R

ragtek

Guest
#3
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.PNG

ssu.PNG

So it would be at least a quick fix, before they want to upgrade the jquery version^^
 

simbolo

Well-known member
#4
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.
 

Mike

XenForo developer
Staff member
#5
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.