Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: make mergeOptions behave the same across browsers (5.x) #4090

Merged
merged 2 commits into from
Feb 16, 2017

Conversation

forbesjo
Copy link
Contributor

@forbesjo forbesjo commented Feb 15, 2017

Description

Object.keys() will error on IE11 instead of default to an empty array, this will make sure that videojs.mergeOptions() has the same behavior across browsers.

Specific Changes proposed

Made a keys() function that defaults to [] when given an non-object.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

`Object.keys()` will error on IE11 instead of default to an empty array
Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

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

One small request, otherwise LGTM.

@@ -30,6 +30,10 @@
*/
const toString = Object.prototype.toString;

const keys = function(object) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we get a JSDoc block for this function, with @private?

/*
* Gives keys of an object
*
* @param {Object} object
Copy link
Contributor

Choose a reason for hiding this comment

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

The doc comments should probably look something like this to follow a similar format for the project. I more descriptive language as well.

/**
 * Get the keys of an Object
 *  
 * @param {Object}
 *        The Object to get the keys from
 *
 * @return {string[]}
 *         An array of the keys from the object. Returns an empty array if the 
 *         object passed in was invalid or had no keys.
 * 
 * @private
 */

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, shamelessly copy/pasted

@brandonocasey brandonocasey merged commit ce19ed5 into videojs:5.x Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants