Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Shallow options #193

Closed
wants to merge 4 commits into from
Closed

Shallow options #193

wants to merge 4 commits into from

Conversation

jzaefferer
Copy link
Member

This addresses the issue of $.widget deep copying all options, which is a problem when dealing with large arrays, both for performance and identity reasons.

The tests are mostly taken from jQuery core's testsuite to maintain compability, with the exception of not deep-copying arrays, just plain objects.

semantics mostly the same, but without cloning anything but plain
objects, e.g. not cloning of arrays
$.widget.extend(settings, options);
same( settings, merged, "Check if extended: settings must be extended" );
same( options, optionsCopy, "Check if not modified: options must not be modified" );
$.widget.extend(settings, null, options);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused what's being tested here. settings has already been extended with options at this point, so the next assertion should be true even if no merging occurs here.

@jzaefferer
Copy link
Member Author

Updated.

@jzaefferer
Copy link
Member Author

Another update.

@jzaefferer
Copy link
Member Author

Okay, now there is another update. Including messed up commit message..

@scottgonzalez
Copy link
Member

Landed in b915325. I switched back to $.extend() on the constructor, since that doesn't deal with options, also removed the test for extending functions, since that shouldn't occur in options.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants