Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: third_party/google_input_tools/third_party/closure_library/closure/goog/net/jsloader.js

Issue 1257313003: Update Google Input Tools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Free up grd resources. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/google_input_tools/third_party/closure_library/closure/goog/net/jsloader.js
diff --git a/third_party/google_input_tools/third_party/closure_library/closure/goog/net/jsloader.js b/third_party/google_input_tools/third_party/closure_library/closure/goog/net/jsloader.js
index 26b025f96f822207445e3f2d39d7d97fad4e86ed..4e58869feab5cfc0288a1ddd5f8a32b00415b8ea 100644
--- a/third_party/google_input_tools/third_party/closure_library/closure/goog/net/jsloader.js
+++ b/third_party/google_input_tools/third_party/closure_library/closure/goog/net/jsloader.js
@@ -28,6 +28,7 @@ goog.require('goog.async.Deferred');
goog.require('goog.debug.Error');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
+goog.require('goog.object');
/**
@@ -56,11 +57,13 @@ goog.net.jsloader.DEFAULT_TIMEOUT = 5000;
* cleanupWhenDone: If true clean up the script tag after script completes to
* load. This is important if you just want to read data from the JavaScript
* and then throw it away. Default is false.
+ * attributes: Additional attributes to set on the script tag.
*
* @typedef {{
* timeout: (number|undefined),
* document: (HTMLDocument|undefined),
- * cleanupWhenDone: (boolean|undefined)
+ * cleanupWhenDone: (boolean|undefined),
+ * attributes: (!Object<string, string>|undefined)
* }}
*/
goog.net.jsloader.Options;
@@ -68,7 +71,7 @@ goog.net.jsloader.Options;
/**
* Scripts (URIs) waiting to be loaded.
- * @type {Array.<string>}
+ * @type {Array<string>}
* @private
*/
goog.net.jsloader.scriptsToLoad_ = [];
@@ -88,7 +91,7 @@ goog.net.jsloader.scriptsToLoad_ = [];
* If you need to load a large number of scripts on the same domain,
* you may want to use goog.module.ModuleLoader.
*
- * @param {Array.<string>} uris The URIs to load.
+ * @param {Array<string>} uris The URIs to load.
* @param {goog.net.jsloader.Options=} opt_options Optional parameters. See
* goog.net.jsloader.options documentation for details.
*/
@@ -181,14 +184,15 @@ goog.net.jsloader.load = function(uri, opt_options) {
'Error while loading script ' + uri));
};
- // Add the script element to the document.
- goog.dom.setProperties(script, {
+ var properties = options.attributes || {};
+ goog.object.extend(properties, {
'type': 'text/javascript',
'charset': 'UTF-8',
// NOTE(user): Safari never loads the script if we don't set
// the src attribute before appending.
'src': uri
});
+ goog.dom.setProperties(script, properties);
var scriptParent = goog.net.jsloader.getScriptParentElement_(doc);
scriptParent.appendChild(script);
@@ -293,7 +297,7 @@ goog.net.jsloader.cancel_ = function() {
var request = this;
if (request && request.script_) {
var scriptNode = request.script_;
- if (scriptNode && scriptNode.tagName == 'SCRIPT') {
+ if (scriptNode && scriptNode.tagName == goog.dom.TagName.SCRIPT) {
goog.net.jsloader.cleanup_(scriptNode, true, request.timeout_);
}
}

Powered by Google App Engine
This is Rietveld 408576698