Skip to content

Commit

Permalink
Update closure-library to fba2eb76bc0e695952480de932d71cc1b7dd9f1f
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyba committed Dec 4, 2014
1 parent c36ef93 commit ac34244
Show file tree
Hide file tree
Showing 75 changed files with 806 additions and 393 deletions.
3 changes: 2 additions & 1 deletion third_party/closure/goog/a11y/aria/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ goog.a11y.aria.setState = function(element, stateName, value) {
*/
goog.a11y.aria.toggleState = function(el, attr) {
var val = goog.a11y.aria.getState(el, attr);
if (!goog.string.isEmptySafe(val) && !(val == 'true' || val == 'false')) {
if (!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(val)) &&
!(val == 'true' || val == 'false')) {
goog.a11y.aria.removeState(el, /** @type {!goog.a11y.aria.State} */ (attr));
return;
}
Expand Down
5 changes: 2 additions & 3 deletions third_party/closure/goog/asserts/asserts.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,9 @@ goog.asserts.assertObjectPrototypeIsIntact = function() {
*/
goog.asserts.getType_ = function(value) {
if (value instanceof Function) {
// TODO(martone): unquote this after the next Closure Compiler release.
return value['displayName'] || value.name || 'unknown type name';
return value.displayName || value.name || 'unknown type name';
} else if (value instanceof Object) {
return value.constructor['displayName'] || value.constructor.name ||
return value.constructor.displayName || value.constructor.name ||
Object.prototype.toString.call(value);
} else {
return value === null ? 'null' : typeof value;
Expand Down
135 changes: 82 additions & 53 deletions third_party/closure/goog/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ goog.constructNamespace_ = function(name, opt_obj) {
};


/**
* Module identifier validation regexp.
* Note: This is a conservative check, it is very possible to be more lienent,
* the primary exclusion here is "/" and "\" and a leading ".", these
* restrictions are intended to leave the door open for using goog.require
* with relative file paths rather than module identifiers.
* @private
*/
goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;


/**
* goog.module serves two purposes:
* - marks a file that must be loaded as a module
Expand All @@ -296,7 +307,9 @@ goog.constructNamespace_ = function(name, opt_obj) {
* "goog.package.part", is expected but not required.
*/
goog.module = function(name) {
if (!goog.isString(name) || !name) {
if (!goog.isString(name) ||
!name ||
name.search(goog.VALID_MODULE_RE_) == -1) {
throw Error('Invalid module identifier');
}
if (!goog.isInModuleLoader_()) {
Expand Down Expand Up @@ -888,58 +901,6 @@ if (goog.DEPENDENCIES_ENABLED) {
goog.queuedModules_ = [];


/**
* Retrieve and execute a module.
* @param {string} src Script source URL.
* @private
*/
goog.retrieveAndExecModule_ = function(src) {
// The full but non-canonicalized URL for later use.
var originalPath = src;

// Canonicalize the path, removing any /./ or /../ since Chrome's debugging
// console doesn't auto-canonicalize XHR loads as it does <script> srcs.
var separator;
while ((separator = src.indexOf('/./')) != -1) {
src = src.substr(0, separator) + src.substr(separator + '/.'.length);
}
while ((separator = src.indexOf('/../')) != -1) {
var previousComponent = src.lastIndexOf('/', separator - 1);
src = src.substr(0, previousComponent) +
src.substr(separator + '/..'.length);
}

var importScript = goog.global.CLOSURE_IMPORT_SCRIPT ||
goog.writeScriptTag_;

var scriptText = null;

var xhr = new goog.global['XMLHttpRequest']();

/** @this {Object} */
xhr.onload = function() {
scriptText = this.responseText;
};
xhr.open('get', src, false);
xhr.send();

scriptText = xhr.responseText;

if (scriptText != null) {
var execModuleScript = goog.wrapModule_(src, scriptText);
var isOldIE = goog.IS_OLD_IE_;
if (isOldIE) {
goog.dependencies_.deferred[originalPath] = execModuleScript;
goog.queuedModules_.push(originalPath);
} else {
importScript(src, execModuleScript);
}
} else {
throw new Error('load of ' + src + 'failed');
}
};


/**
* Return an appropriate module text. Suitable to insert into
* a script tag (that is unescaped).
Expand Down Expand Up @@ -1324,6 +1285,74 @@ if (goog.DEPENDENCIES_ENABLED) {
}


/**
* Normalize a file path by removing redundant ".." and extraneous "." file
* path components.
* @param {string} path
* @return {string}
* @private
*/
goog.normalizePath_ = function(path) {
var components = path.split('/');
var i = 0;
while (i < components.length) {
if (components[i] == '.') {
components.splice(i, 1);
} else if (i && components[i] == '..' &&
components[i - 1] && components[i - 1] != '..') {
components.splice(--i, 2);
} else {
i++;
}
}
return components.join('/');
};


/**
* Retrieve and execute a module.
* @param {string} src Script source URL.
* @private
*/
goog.retrieveAndExecModule_ = function(src) {
if (!COMPILED) {
// The full but non-canonicalized URL for later use.
var originalPath = src;
// Canonicalize the path, removing any /./ or /../ since Chrome's debugging
// console doesn't auto-canonicalize XHR loads as it does <script> srcs.
src = goog.normalizePath_(src);

var importScript = goog.global.CLOSURE_IMPORT_SCRIPT ||
goog.writeScriptTag_;

var scriptText = null;

var xhr = new goog.global['XMLHttpRequest']();

/** @this {Object} */
xhr.onload = function() {
scriptText = this.responseText;
};
xhr.open('get', src, false);
xhr.send();

scriptText = xhr.responseText;

if (scriptText != null) {
var execModuleScript = goog.wrapModule_(src, scriptText);
var isOldIE = goog.IS_OLD_IE_;
if (isOldIE) {
goog.dependencies_.deferred[originalPath] = execModuleScript;
goog.queuedModules_.push(originalPath);
} else {
importScript(src, execModuleScript);
}
} else {
throw new Error('load of ' + src + 'failed');
}
}
};


//==============================================================================
// Language Enhancements
Expand Down
4 changes: 2 additions & 2 deletions third_party/closure/goog/cssom/cssom.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ goog.cssom.getAllCssText = function(opt_styleSheet) {
*/
goog.cssom.getAllCssStyleRules = function(opt_styleSheet) {
var styleSheet = opt_styleSheet || document.styleSheets;
return /** @type {Array<CSSStyleRule>} */ (
return /** @type {!Array<CSSStyleRule>} */ (
goog.cssom.getAllCss_(styleSheet, false));
};

Expand Down Expand Up @@ -146,7 +146,7 @@ goog.cssom.getAllCssStyleSheets = function(opt_styleSheet,
// to see if there are styleSheets buried in there.
// If we have a CSSStyleSheet within CssRules.
var cssRuleList = goog.cssom.getCssRulesFromStyleSheet(
/** @type {CSSStyleSheet} */ (styleSheet));
/** @type {!CSSStyleSheet} */ (styleSheet));
if (cssRuleList && cssRuleList.length) {
// Chrome does not evaluate cssRuleList[i] to undefined when i >=n;
// so we use a (i < n) check instead of cssRuleList[i] in the loop below
Expand Down
6 changes: 3 additions & 3 deletions third_party/closure/goog/cssom/iframe/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ goog.cssom.iframe.style.getBackgroundContext = function(element) {
while ((ancestor = ancestor.parentNode) &&
ancestor.nodeType == goog.dom.NodeType.ELEMENT) {
var computedStyle = goog.cssom.iframe.style.getComputedStyleObject_(
/** @type {Element} */ (ancestor));
/** @type {!Element} */ (ancestor));
// Copy background color if a non-transparent value is found.
var backgroundColorValue = computedStyle['backgroundColor'];
if (!goog.cssom.iframe.style.isTransparentValue_(backgroundColorValue)) {
Expand All @@ -962,8 +962,8 @@ goog.cssom.iframe.style.getBackgroundContext = function(element) {
element, currentIframeWindow);
var frameElement = currentIframeWindow.frameElement;
var iframeRelativePosition = goog.style.getRelativePosition(
/** @type {Element} */ (frameElement),
/** @type {Element} */ (ancestor));
/** @type {!Element} */ (frameElement),
/** @type {!Element} */ (ancestor));
var iframeBorders = goog.style.getBorderBox(frameElement);
relativePosition.x += iframeRelativePosition.x + iframeBorders.left;
relativePosition.y += iframeRelativePosition.y + iframeBorders.top;
Expand Down
2 changes: 1 addition & 1 deletion third_party/closure/goog/datasource/fastdatanode.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ goog.ds.FastDataNode.prototype.getJsObject = function() {
* @return {goog.ds.FastDataNode} Clone of this data node.
*/
goog.ds.FastDataNode.prototype.clone = function() {
return /** @type {goog.ds.FastDataNode} */(goog.ds.FastDataNode.fromJs(
return /** @type {!goog.ds.FastDataNode} */(goog.ds.FastDataNode.fromJs(
this.getJsObject(), this.getDataName()));
};

Expand Down
6 changes: 3 additions & 3 deletions third_party/closure/goog/db/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ goog.db.Transaction = function(tx, db) {
// TODO(user): remove these casts once the externs file is updated to
// correctly reflect that IDBTransaction extends EventTarget
this.eventHandler_.listen(
/** @type {EventTarget} */ (this.tx_),
/** @type {!EventTarget} */ (this.tx_),
'complete',
goog.bind(
this.dispatchEvent,
this,
goog.db.Transaction.EventTypes.COMPLETE));
this.eventHandler_.listen(
/** @type {EventTarget} */ (this.tx_),
/** @type {!EventTarget} */ (this.tx_),
'abort',
goog.bind(
this.dispatchEvent,
this,
goog.db.Transaction.EventTypes.ABORT));
this.eventHandler_.listen(
/** @type {EventTarget} */ (this.tx_),
/** @type {!EventTarget} */ (this.tx_),
'error',
this.dispatchError_);
};
Expand Down
6 changes: 4 additions & 2 deletions third_party/closure/goog/deps.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion third_party/closure/goog/dom/browserrange/ierange.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ goog.dom.browserrange.IeRange.insertNode_ = function(clone, node,

clone.collapse(before);
node = goog.dom.browserrange.IeRange.pasteElement_(clone,
/** @type {Element} */ (node), opt_domHelper);
/** @type {!Element} */ (node), opt_domHelper);

// If we didn't want an element, unwrap the element and return the node.
if (isNonElement) {
Expand Down
2 changes: 1 addition & 1 deletion third_party/closure/goog/dom/browserrange/w3crange.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ goog.dom.browserrange.W3cRange.prototype.getValidHtml = function() {
container.parentNode;

var html = goog.dom.getOuterHtml(
/** @type {Element} */ (container.cloneNode(false)));
/** @type {!Element} */ (container.cloneNode(false)));
return html.replace('>', '>' + result);
};

Expand Down
8 changes: 4 additions & 4 deletions third_party/closure/goog/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ goog.dom.getChildren = function(element) {
*/
goog.dom.getFirstElementChild = function(node) {
if (node.firstElementChild != undefined) {
return /** @type {Element} */(node).firstElementChild;
return /** @type {!Element} */(node).firstElementChild;
}
return goog.dom.getNextElementNode_(node.firstChild, true);
};
Expand All @@ -1155,7 +1155,7 @@ goog.dom.getFirstElementChild = function(node) {
*/
goog.dom.getLastElementChild = function(node) {
if (node.lastElementChild != undefined) {
return /** @type {Element} */(node).lastElementChild;
return /** @type {!Element} */(node).lastElementChild;
}
return goog.dom.getNextElementNode_(node.lastChild, false);
};
Expand All @@ -1168,7 +1168,7 @@ goog.dom.getLastElementChild = function(node) {
*/
goog.dom.getNextElementSibling = function(node) {
if (node.nextElementSibling != undefined) {
return /** @type {Element} */(node).nextElementSibling;
return /** @type {!Element} */(node).nextElementSibling;
}
return goog.dom.getNextElementNode_(node.nextSibling, true);
};
Expand All @@ -1182,7 +1182,7 @@ goog.dom.getNextElementSibling = function(node) {
*/
goog.dom.getPreviousElementSibling = function(node) {
if (node.previousElementSibling != undefined) {
return /** @type {Element} */(node).previousElementSibling;
return /** @type {!Element} */(node).previousElementSibling;
}
return goog.dom.getNextElementNode_(node.previousSibling, false);
};
Expand Down
7 changes: 4 additions & 3 deletions third_party/closure/goog/dom/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ goog.require('goog.structs.Map');
* Returns form data as a map of name to value arrays. This doesn't
* support file inputs.
* @param {HTMLFormElement} form The form.
* @return {!goog.structs.Map} A map of the form data as form name to arrays of
* values.
* @return {!goog.structs.Map.<string, !Array.<string>>} A map of the form data
* as field name to arrays of values.
*/
goog.dom.forms.getFormDataMap = function(form) {
var map = new goog.structs.Map();
Expand Down Expand Up @@ -117,7 +117,7 @@ goog.dom.forms.getFormDataHelper_ = function(form, result, fnAppend) {

/**
* Adds the name/value pair to the map.
* @param {goog.structs.Map} map The map to add to.
* @param {!goog.structs.Map.<string, !Array.<string>>} map The map to add to.
* @param {string} name The name.
* @param {string} value The value.
* @private
Expand Down Expand Up @@ -247,6 +247,7 @@ goog.dom.forms.getValue = function(el) {
* Alias for goog.dom.form.element.getValue
* @type {Function}
* @deprecated Use {@link goog.dom.forms.getValue} instead.
* @suppress {missingProvide}
*/
goog.dom.$F = goog.dom.forms.getValue;

Expand Down
2 changes: 1 addition & 1 deletion third_party/closure/goog/dom/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ goog.dom.Range.createFromBrowserSelection = function(selection) {
} else if (selection.rangeCount) {
if (selection.rangeCount > 1) {
return goog.dom.MultiRange.createFromBrowserSelection(
/** @type {Selection} */ (selection));
/** @type {!Selection} */ (selection));
} else {
range = selection.getRangeAt(0);
isReversed = goog.dom.Range.isReversed(selection.anchorNode,
Expand Down
2 changes: 1 addition & 1 deletion third_party/closure/goog/editor/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ goog.editor.Field.prototype.makeIframeField_ = function(opt_iframeSrc) {
html = this.reduceOp_(goog.editor.Plugin.Op.PREPARE_CONTENTS_HTML,
html, styles);

var iframe = /** @type {HTMLIFrameElement} */(
var iframe = /** @type {!HTMLIFrameElement} */(
this.originalDomHelper.createDom(goog.dom.TagName.IFRAME,
this.getIframeAttributes()));

Expand Down
2 changes: 1 addition & 1 deletion third_party/closure/goog/editor/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ goog.editor.node.getChildHelper_ = function(parent, isReversed) {
return (!parent || parent.nodeType != goog.dom.NodeType.ELEMENT) ? null :
/** @type {Node} */ (goog.editor.node.getFirstValue_(goog.iter.filter(
new goog.dom.iter.ChildIterator(
/** @type {Element} */ (parent), isReversed),
/** @type {!Element} */ (parent), isReversed),
goog.editor.node.isImportant)));
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ goog.editor.plugins.BasicTextFormatter.prototype.fixSafariLists_ = function() {
var range = node.ownerDocument.createRange();
range.setStartAfter(previousElementSibling);
range.setEndBefore(node);
if (!goog.string.isEmpty(range.toString())) {
if (!goog.string.isEmptyOrWhitespace(range.toString())) {
return;
}
// Make sure both are lists of the same type (ordered or unordered)
Expand Down
Loading

0 comments on commit ac34244

Please sign in to comment.