forked from extern/egroupware
Performance improvement:
JSON stringify/parsing deep object copy is quite faster than jQuery.extend deep copy, especially in IE
This commit is contained in:
parent
aba5cf102f
commit
092cbb5059
@ -780,7 +780,7 @@ jQuery.extend(et2_selectbox,
|
||||
{
|
||||
var name_parts = widget.id.replace(/[/g,'[').replace(/]|]/g,'').split('[');
|
||||
|
||||
var type_options = [];
|
||||
var type_options = {};
|
||||
var content_options = {};
|
||||
|
||||
// First check type, there may be static options. There's some special handling
|
||||
@ -796,7 +796,18 @@ jQuery.extend(et2_selectbox,
|
||||
attrs.other = attrs.other.split(',');
|
||||
}
|
||||
// Copy, to avoid accidental modification
|
||||
jQuery.extend(true, type_options, this[type_function].call(this, widget, attrs));
|
||||
//
|
||||
// type options used to use jQuery.extend deep copy to get a clone object of options
|
||||
// but as jQuery.extend deep copy is very expensive operation in MSIE (in this case almost 400ms)
|
||||
// we use JSON parsing instead to copy the options object
|
||||
type_options = this[type_function].call(this, widget, attrs);
|
||||
try{
|
||||
type_options = JSON.parse(JSON.stringify(type_options));
|
||||
}catch(e)
|
||||
{
|
||||
egw.debug(e);
|
||||
}
|
||||
|
||||
widget._type = old_type;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user