浏览代码

remove view-option-hash support

Adam Shaw 9 年之前
父节点
当前提交
60b7d637b5
共有 3 个文件被更改,包括 2 次插入54 次删除
  1. 1 0
      CHANGELOG.md
  2. 1 4
      src/Calendar.js
  3. 0 50
      src/main.js

+ 1 - 0
CHANGELOG.md

@@ -28,6 +28,7 @@ Breaking Changes:
 	- `isSame`
 	- `isBefore`
 	- `isAfter`
+- View-Option-Hashes no longer supported (deprecated in 2.2.4)
 - DOM structure of month/basic-view day cell numbers changed
 
 Build System:

+ 1 - 4
src/Calendar.js

@@ -299,10 +299,7 @@ function Calendar_constructor(element, overrides) {
 	t.dynamicOverrides = {};
 	t.viewSpecCache = {};
 	t.optionHandlers = {}; // for Calendar.options.js
-
-	// convert legacy options into non-legacy ones.
-	// in the future, when this is removed, don't use `overrides` reference. make a copy.
-	t.overrides = massageOverrides(overrides || {});
+	t.overrides = $.extend({}, overrides); // make a copy
 
 	t.populateOptionsHash(); // sets this.options
 

+ 0 - 50
src/main.js

@@ -51,53 +51,3 @@ var complexOptions = [ // names of options that are objects whose properties sho
 function mergeOptions(optionObjs) {
 	return mergeProps(optionObjs, complexOptions);
 }
-
-
-// Given options specified for the calendar's constructor, massages any legacy options into a non-legacy form.
-// Converts View-Option-Hashes into the View-Specific-Options format.
-function massageOverrides(input) {
-	var overrides = { views: input.views || {} }; // the output. ensure a `views` hash
-	var subObj;
-
-	// iterate through all option override properties (except `views`)
-	$.each(input, function(name, val) {
-		if (name != 'views') {
-
-			// could the value be a legacy View-Option-Hash?
-			if (
-				$.isPlainObject(val) &&
-				!/(time|duration|interval)$/i.test(name) && // exclude duration options. might be given as objects
-				$.inArray(name, complexOptions) == -1 // complex options aren't allowed to be View-Option-Hashes
-			) {
-				subObj = null;
-
-				// iterate through the properties of this possible View-Option-Hash value
-				$.each(val, function(subName, subVal) {
-
-					// is the property targeting a view?
-					if (/^(month|week|day|default|basic(Week|Day)?|agenda(Week|Day)?)$/.test(subName)) {
-						if (!overrides.views[subName]) { // ensure the view-target entry exists
-							overrides.views[subName] = {};
-						}
-						overrides.views[subName][name] = subVal; // record the value in the `views` object
-					}
-					else { // a non-View-Option-Hash property
-						if (!subObj) {
-							subObj = {};
-						}
-						subObj[subName] = subVal; // accumulate these unrelated values for later
-					}
-				});
-
-				if (subObj) { // non-View-Option-Hash properties? transfer them as-is
-					overrides[name] = subObj;
-				}
-			}
-			else {
-				overrides[name] = val; // transfer normal options as-is
-			}
-		}
-	});
-
-	return overrides;
-}