Added compiled JavaScript to repository for GitHub pages
This feels like a mistake...
This commit is contained in:
parent
3d5a2fb322
commit
dc226b1f25
468 changed files with 212152 additions and 2 deletions
73
resources/public/js/compiled/out/goog/dom/browserfeature.js
Normal file
73
resources/public/js/compiled/out/goog/dom/browserfeature.js
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// Copyright 2010 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Browser capability checks for the dom package.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
goog.provide('goog.dom.BrowserFeature');
|
||||
|
||||
goog.require('goog.userAgent');
|
||||
|
||||
|
||||
/**
|
||||
* Enum of browser capabilities.
|
||||
* @enum {boolean}
|
||||
*/
|
||||
goog.dom.BrowserFeature = {
|
||||
/**
|
||||
* Whether attributes 'name' and 'type' can be added to an element after it's
|
||||
* created. False in Internet Explorer prior to version 9.
|
||||
*/
|
||||
CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:
|
||||
!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9),
|
||||
|
||||
/**
|
||||
* Whether we can use element.children to access an element's Element
|
||||
* children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment
|
||||
* nodes in the collection.)
|
||||
*/
|
||||
CAN_USE_CHILDREN_ATTRIBUTE: !goog.userAgent.GECKO && !goog.userAgent.IE ||
|
||||
goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) ||
|
||||
goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9.1'),
|
||||
|
||||
/**
|
||||
* Opera, Safari 3, and Internet Explorer 9 all support innerText but they
|
||||
* include text nodes in script and style tags. Not document-mode-dependent.
|
||||
*/
|
||||
CAN_USE_INNER_TEXT:
|
||||
(goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')),
|
||||
|
||||
/**
|
||||
* MSIE, Opera, and Safari>=4 support element.parentElement to access an
|
||||
* element's parent if it is an Element.
|
||||
*/
|
||||
CAN_USE_PARENT_ELEMENT_PROPERTY:
|
||||
goog.userAgent.IE || goog.userAgent.OPERA || goog.userAgent.WEBKIT,
|
||||
|
||||
/**
|
||||
* Whether NoScope elements need a scoped element written before them in
|
||||
* innerHTML.
|
||||
* MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#1
|
||||
*/
|
||||
INNER_HTML_NEEDS_SCOPED_ELEMENT: goog.userAgent.IE,
|
||||
|
||||
/**
|
||||
* Whether we use legacy IE range API.
|
||||
*/
|
||||
LEGACY_IE_RANGES:
|
||||
goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)
|
||||
};
|
||||
157
resources/public/js/compiled/out/goog/dom/dataset.js
Normal file
157
resources/public/js/compiled/out/goog/dom/dataset.js
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
// Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Utilities for adding, removing and setting values in
|
||||
* an Element's dataset.
|
||||
* See {@link http://www.w3.org/TR/html5/Overview.html#dom-dataset}.
|
||||
*
|
||||
* @author nicksay@google.com (Alex Nicksay)
|
||||
*/
|
||||
|
||||
goog.provide('goog.dom.dataset');
|
||||
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.userAgent.product');
|
||||
|
||||
|
||||
/**
|
||||
* Whether using the dataset property is allowed. In IE (up to and including
|
||||
* IE 11), setting element.dataset in JS does not propagate values to CSS,
|
||||
* breaking expressions such as `content: attr(data-content)` that would
|
||||
* otherwise work.
|
||||
* See {@link https://github.com/google/closure-library/issues/396}.
|
||||
* @const
|
||||
* @private
|
||||
*/
|
||||
goog.dom.dataset.ALLOWED_ = !goog.userAgent.product.IE;
|
||||
|
||||
|
||||
/**
|
||||
* The DOM attribute name prefix that must be present for it to be considered
|
||||
* for a dataset.
|
||||
* @type {string}
|
||||
* @const
|
||||
* @private
|
||||
*/
|
||||
goog.dom.dataset.PREFIX_ = 'data-';
|
||||
|
||||
|
||||
/**
|
||||
* Sets a custom data attribute on an element. The key should be
|
||||
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
|
||||
* @param {Element} element DOM node to set the custom data attribute on.
|
||||
* @param {string} key Key for the custom data attribute.
|
||||
* @param {string} value Value for the custom data attribute.
|
||||
*/
|
||||
goog.dom.dataset.set = function(element, key, value) {
|
||||
if (goog.dom.dataset.ALLOWED_ && element.dataset) {
|
||||
element.dataset[key] = value;
|
||||
} else {
|
||||
element.setAttribute(
|
||||
goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(key), value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets a custom data attribute from an element. The key should be
|
||||
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
|
||||
* @param {Element} element DOM node to get the custom data attribute from.
|
||||
* @param {string} key Key for the custom data attribute.
|
||||
* @return {?string} The attribute value, if it exists.
|
||||
*/
|
||||
goog.dom.dataset.get = function(element, key) {
|
||||
if (goog.dom.dataset.ALLOWED_ && element.dataset) {
|
||||
// Android browser (non-chrome) returns the empty string for
|
||||
// element.dataset['doesNotExist'].
|
||||
if (!(key in element.dataset)) {
|
||||
return null;
|
||||
}
|
||||
return element.dataset[key];
|
||||
} else {
|
||||
return element.getAttribute(
|
||||
goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(key));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes a custom data attribute from an element. The key should be
|
||||
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
|
||||
* @param {Element} element DOM node to get the custom data attribute from.
|
||||
* @param {string} key Key for the custom data attribute.
|
||||
*/
|
||||
goog.dom.dataset.remove = function(element, key) {
|
||||
if (goog.dom.dataset.ALLOWED_ && element.dataset) {
|
||||
// In strict mode Safari will trigger an error when trying to delete a
|
||||
// property which does not exist.
|
||||
if (goog.dom.dataset.has(element, key)) {
|
||||
delete element.dataset[key];
|
||||
}
|
||||
} else {
|
||||
element.removeAttribute(
|
||||
goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(key));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether custom data attribute exists on an element. The key should be
|
||||
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
|
||||
*
|
||||
* @param {Element} element DOM node to get the custom data attribute from.
|
||||
* @param {string} key Key for the custom data attribute.
|
||||
* @return {boolean} Whether the attribute exists.
|
||||
*/
|
||||
goog.dom.dataset.has = function(element, key) {
|
||||
if (goog.dom.dataset.ALLOWED_ && element.dataset) {
|
||||
return key in element.dataset;
|
||||
} else if (element.hasAttribute) {
|
||||
return element.hasAttribute(
|
||||
goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(key));
|
||||
} else {
|
||||
return !!(
|
||||
element.getAttribute(
|
||||
goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(key)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets all custom data attributes as a string map. The attribute names will be
|
||||
* camel cased (e.g., data-foo-bar -> dataset['fooBar']). This operation is not
|
||||
* safe for attributes having camel-cased names clashing with already existing
|
||||
* properties (e.g., data-to-string -> dataset['toString']).
|
||||
* @param {!Element} element DOM node to get the data attributes from.
|
||||
* @return {!Object} The string map containing data attributes and their
|
||||
* respective values.
|
||||
*/
|
||||
goog.dom.dataset.getAll = function(element) {
|
||||
if (goog.dom.dataset.ALLOWED_ && element.dataset) {
|
||||
return element.dataset;
|
||||
} else {
|
||||
var dataset = {};
|
||||
var attributes = element.attributes;
|
||||
for (var i = 0; i < attributes.length; ++i) {
|
||||
var attribute = attributes[i];
|
||||
if (goog.string.startsWith(attribute.name, goog.dom.dataset.PREFIX_)) {
|
||||
// We use substr(5), since it's faster than replacing 'data-' with ''.
|
||||
var key = goog.string.toCamelCase(attribute.name.substr(5));
|
||||
dataset[key] = attribute.value;
|
||||
}
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
};
|
||||
2992
resources/public/js/compiled/out/goog/dom/dom.js
Normal file
2992
resources/public/js/compiled/out/goog/dom/dom.js
Normal file
File diff suppressed because it is too large
Load diff
48
resources/public/js/compiled/out/goog/dom/nodetype.js
Normal file
48
resources/public/js/compiled/out/goog/dom/nodetype.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Definition of goog.dom.NodeType.
|
||||
*/
|
||||
|
||||
goog.provide('goog.dom.NodeType');
|
||||
|
||||
|
||||
/**
|
||||
* Constants for the nodeType attribute in the Node interface.
|
||||
*
|
||||
* These constants match those specified in the Node interface. These are
|
||||
* usually present on the Node object in recent browsers, but not in older
|
||||
* browsers (specifically, early IEs) and thus are given here.
|
||||
*
|
||||
* In some browsers (early IEs), these are not defined on the Node object,
|
||||
* so they are provided here.
|
||||
*
|
||||
* See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
|
||||
* @enum {number}
|
||||
*/
|
||||
goog.dom.NodeType = {
|
||||
ELEMENT: 1,
|
||||
ATTRIBUTE: 2,
|
||||
TEXT: 3,
|
||||
CDATA_SECTION: 4,
|
||||
ENTITY_REFERENCE: 5,
|
||||
ENTITY: 6,
|
||||
PROCESSING_INSTRUCTION: 7,
|
||||
COMMENT: 8,
|
||||
DOCUMENT: 9,
|
||||
DOCUMENT_TYPE: 10,
|
||||
DOCUMENT_FRAGMENT: 11,
|
||||
NOTATION: 12
|
||||
};
|
||||
372
resources/public/js/compiled/out/goog/dom/safe.js
Normal file
372
resources/public/js/compiled/out/goog/dom/safe.js
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Type-safe wrappers for unsafe DOM APIs.
|
||||
*
|
||||
* This file provides type-safe wrappers for DOM APIs that can result in
|
||||
* cross-site scripting (XSS) vulnerabilities, if the API is supplied with
|
||||
* untrusted (attacker-controlled) input. Instead of plain strings, the type
|
||||
* safe wrappers consume values of types from the goog.html package whose
|
||||
* contract promises that values are safe to use in the corresponding context.
|
||||
*
|
||||
* Hence, a program that exclusively uses the wrappers in this file (i.e., whose
|
||||
* only reference to security-sensitive raw DOM APIs are in this file) is
|
||||
* guaranteed to be free of XSS due to incorrect use of such DOM APIs (modulo
|
||||
* correctness of code that produces values of the respective goog.html types,
|
||||
* and absent code that violates type safety).
|
||||
*
|
||||
* For example, assigning to an element's .innerHTML property a string that is
|
||||
* derived (even partially) from untrusted input typically results in an XSS
|
||||
* vulnerability. The type-safe wrapper goog.html.setInnerHtml consumes a value
|
||||
* of type goog.html.SafeHtml, whose contract states that using its values in a
|
||||
* HTML context will not result in XSS. Hence a program that is free of direct
|
||||
* assignments to any element's innerHTML property (with the exception of the
|
||||
* assignment to .innerHTML in this file) is guaranteed to be free of XSS due to
|
||||
* assignment of untrusted strings to the innerHTML property.
|
||||
*/
|
||||
|
||||
goog.provide('goog.dom.safe');
|
||||
goog.provide('goog.dom.safe.InsertAdjacentHtmlPosition');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.html.SafeHtml');
|
||||
goog.require('goog.html.SafeUrl');
|
||||
goog.require('goog.html.TrustedResourceUrl');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.string.Const');
|
||||
|
||||
|
||||
/** @enum {string} */
|
||||
goog.dom.safe.InsertAdjacentHtmlPosition = {
|
||||
AFTERBEGIN: 'afterbegin',
|
||||
AFTEREND: 'afterend',
|
||||
BEFOREBEGIN: 'beforebegin',
|
||||
BEFOREEND: 'beforeend'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Inserts known-safe HTML into a Node, at the specified position.
|
||||
* @param {!Node} node The node on which to call insertAdjacentHTML.
|
||||
* @param {!goog.dom.safe.InsertAdjacentHtmlPosition} position Position where
|
||||
* to insert the HTML.
|
||||
* @param {!goog.html.SafeHtml} html The known-safe HTML to insert.
|
||||
*/
|
||||
goog.dom.safe.insertAdjacentHtml = function(node, position, html) {
|
||||
node.insertAdjacentHTML(position, goog.html.SafeHtml.unwrap(html));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Assigns known-safe HTML to an element's innerHTML property.
|
||||
* @param {!Element} elem The element whose innerHTML is to be assigned to.
|
||||
* @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
|
||||
*/
|
||||
goog.dom.safe.setInnerHtml = function(elem, html) {
|
||||
elem.innerHTML = goog.html.SafeHtml.unwrap(html);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Assigns known-safe HTML to an element's outerHTML property.
|
||||
* @param {!Element} elem The element whose outerHTML is to be assigned to.
|
||||
* @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
|
||||
*/
|
||||
goog.dom.safe.setOuterHtml = function(elem, html) {
|
||||
elem.outerHTML = goog.html.SafeHtml.unwrap(html);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Writes known-safe HTML to a document.
|
||||
* @param {!Document} doc The document to be written to.
|
||||
* @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
|
||||
*/
|
||||
goog.dom.safe.documentWrite = function(doc, html) {
|
||||
doc.write(goog.html.SafeHtml.unwrap(html));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an anchor element's href property.
|
||||
*
|
||||
* If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
|
||||
* anchor's href property. If url is of type string however, it is first
|
||||
* sanitized using goog.html.SafeUrl.sanitize.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setAnchorHref(anchorEl, url);
|
||||
* which is a safe alternative to
|
||||
* anchorEl.href = url;
|
||||
* The latter can result in XSS vulnerabilities if url is a
|
||||
* user-/attacker-controlled value.
|
||||
*
|
||||
* @param {!HTMLAnchorElement} anchor The anchor element whose href property
|
||||
* is to be assigned to.
|
||||
* @param {string|!goog.html.SafeUrl} url The URL to assign.
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setAnchorHref = function(anchor, url) {
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
}
|
||||
anchor.href = goog.html.SafeUrl.unwrap(safeUrl);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an image element's src property.
|
||||
*
|
||||
* If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
|
||||
* image's src property. If url is of type string however, it is first
|
||||
* sanitized using goog.html.SafeUrl.sanitize.
|
||||
*
|
||||
* @param {!HTMLImageElement} imageElement The image element whose src property
|
||||
* is to be assigned to.
|
||||
* @param {string|!goog.html.SafeUrl} url The URL to assign.
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setImageSrc = function(imageElement, url) {
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
}
|
||||
imageElement.src = goog.html.SafeUrl.unwrap(safeUrl);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an embed element's src property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setEmbedSrc(embedEl, url);
|
||||
* which is a safe alternative to
|
||||
* embedEl.src = url;
|
||||
* The latter can result in loading untrusted code unless it is ensured that
|
||||
* the URL refers to a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLEmbedElement} embed The embed element whose src property
|
||||
* is to be assigned to.
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setEmbedSrc = function(embed, url) {
|
||||
embed.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to a frame element's src property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setFrameSrc(frameEl, url);
|
||||
* which is a safe alternative to
|
||||
* frameEl.src = url;
|
||||
* The latter can result in loading untrusted code unless it is ensured that
|
||||
* the URL refers to a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLFrameElement} frame The frame element whose src property
|
||||
* is to be assigned to.
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setFrameSrc = function(frame, url) {
|
||||
frame.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an iframe element's src property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setIframeSrc(iframeEl, url);
|
||||
* which is a safe alternative to
|
||||
* iframeEl.src = url;
|
||||
* The latter can result in loading untrusted code unless it is ensured that
|
||||
* the URL refers to a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLIFrameElement} iframe The iframe element whose src property
|
||||
* is to be assigned to.
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setIframeSrc = function(iframe, url) {
|
||||
iframe.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely sets a link element's href and rel properties. Whether or not
|
||||
* the URL assigned to href has to be a goog.html.TrustedResourceUrl
|
||||
* depends on the value of the rel property. If rel contains "stylesheet"
|
||||
* then a TrustedResourceUrl is required.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setLinkHrefAndRel(linkEl, url, 'stylesheet');
|
||||
* which is a safe alternative to
|
||||
* linkEl.rel = 'stylesheet';
|
||||
* linkEl.href = url;
|
||||
* The latter can result in loading untrusted code unless it is ensured that
|
||||
* the URL refers to a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLLinkElement} link The link element whose href property
|
||||
* is to be assigned to.
|
||||
* @param {string|!goog.html.SafeUrl|!goog.html.TrustedResourceUrl} url The URL
|
||||
* to assign to the href property. Must be a TrustedResourceUrl if the
|
||||
* value assigned to rel contains "stylesheet". A string value is
|
||||
* sanitized with goog.html.SafeUrl.sanitize.
|
||||
* @param {string} rel The value to assign to the rel property.
|
||||
* @throws {Error} if rel contains "stylesheet" and url is not a
|
||||
* TrustedResourceUrl
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) {
|
||||
link.rel = rel;
|
||||
if (goog.string.caseInsensitiveContains(rel, 'stylesheet')) {
|
||||
goog.asserts.assert(
|
||||
url instanceof goog.html.TrustedResourceUrl,
|
||||
'URL must be TrustedResourceUrl because "rel" contains "stylesheet"');
|
||||
link.href = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
} else if (url instanceof goog.html.TrustedResourceUrl) {
|
||||
link.href = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
} else if (url instanceof goog.html.SafeUrl) {
|
||||
link.href = goog.html.SafeUrl.unwrap(url);
|
||||
} else { // string
|
||||
// SafeUrl.sanitize must return legitimate SafeUrl when passed a string.
|
||||
link.href = goog.html.SafeUrl.sanitize(url).getTypedStringValue();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an object element's data property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setObjectData(objectEl, url);
|
||||
* which is a safe alternative to
|
||||
* objectEl.data = url;
|
||||
* The latter can result in loading untrusted code unless setit is ensured that
|
||||
* the URL refers to a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLObjectElement} object The object element whose data property
|
||||
* is to be assigned to.
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setObjectData = function(object, url) {
|
||||
object.data = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an iframe element's src property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setScriptSrc(scriptEl, url);
|
||||
* which is a safe alternative to
|
||||
* scriptEl.src = url;
|
||||
* The latter can result in loading untrusted code unless it is ensured that
|
||||
* the URL refers to a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLScriptElement} script The script element whose src property
|
||||
* is to be assigned to.
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setScriptSrc = function(script, url) {
|
||||
script.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to a Location object's href property.
|
||||
*
|
||||
* If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to
|
||||
* loc's href property. If url is of type string however, it is first sanitized
|
||||
* using goog.html.SafeUrl.sanitize.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setLocationHref(document.location, redirectUrl);
|
||||
* which is a safe alternative to
|
||||
* document.location.href = redirectUrl;
|
||||
* The latter can result in XSS vulnerabilities if redirectUrl is a
|
||||
* user-/attacker-controlled value.
|
||||
*
|
||||
* @param {!Location} loc The Location object whose href property is to be
|
||||
* assigned to.
|
||||
* @param {string|!goog.html.SafeUrl} url The URL to assign.
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setLocationHref = function(loc, url) {
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
}
|
||||
loc.href = goog.html.SafeUrl.unwrap(safeUrl);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely opens a URL in a new window (via window.open).
|
||||
*
|
||||
* If url is of type goog.html.SafeUrl, its value is unwrapped and passed in to
|
||||
* window.open. If url is of type string however, it is first sanitized
|
||||
* using goog.html.SafeUrl.sanitize.
|
||||
*
|
||||
* Note that this function does not prevent leakages via the referer that is
|
||||
* sent by window.open. It is advised to only use this to open 1st party URLs.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.openInWindow(url);
|
||||
* which is a safe alternative to
|
||||
* window.open(url);
|
||||
* The latter can result in XSS vulnerabilities if redirectUrl is a
|
||||
* user-/attacker-controlled value.
|
||||
*
|
||||
* @param {string|!goog.html.SafeUrl} url The URL to open.
|
||||
* @param {Window=} opt_openerWin Window of which to call the .open() method.
|
||||
* Defaults to the global window.
|
||||
* @param {!goog.string.Const=} opt_name Name of the window to open in. Can be
|
||||
* _top, etc as allowed by window.open().
|
||||
* @param {string=} opt_specs Comma-separated list of specifications, same as
|
||||
* in window.open().
|
||||
* @param {boolean=} opt_replace Whether to replace the current entry in browser
|
||||
* history, same as in window.open().
|
||||
* @return {Window} Window the url was opened in.
|
||||
*/
|
||||
goog.dom.safe.openInWindow = function(
|
||||
url, opt_openerWin, opt_name, opt_specs, opt_replace) {
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
}
|
||||
var win = opt_openerWin || window;
|
||||
return win.open(
|
||||
goog.html.SafeUrl.unwrap(safeUrl),
|
||||
// If opt_name is undefined, simply passing that in to open() causes IE to
|
||||
// reuse the current window instead of opening a new one. Thus we pass ''
|
||||
// in instead, which according to spec opens a new window. See
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#dom-open .
|
||||
opt_name ? goog.string.Const.unwrap(opt_name) : '', opt_specs,
|
||||
opt_replace);
|
||||
};
|
||||
160
resources/public/js/compiled/out/goog/dom/tagname.js
Normal file
160
resources/public/js/compiled/out/goog/dom/tagname.js
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Defines the goog.dom.TagName enum. This enumerates
|
||||
* all HTML tag names specified in either the the W3C HTML 4.01 index of
|
||||
* elements or the HTML5 draft specification.
|
||||
*
|
||||
* References:
|
||||
* http://www.w3.org/TR/html401/index/elements.html
|
||||
* http://dev.w3.org/html5/spec/section-index.html
|
||||
*
|
||||
*/
|
||||
goog.provide('goog.dom.TagName');
|
||||
|
||||
|
||||
/**
|
||||
* Enum of all html tag names specified by the W3C HTML4.01 and HTML5
|
||||
* specifications.
|
||||
* @enum {string}
|
||||
*/
|
||||
goog.dom.TagName = {
|
||||
A: 'A',
|
||||
ABBR: 'ABBR',
|
||||
ACRONYM: 'ACRONYM',
|
||||
ADDRESS: 'ADDRESS',
|
||||
APPLET: 'APPLET',
|
||||
AREA: 'AREA',
|
||||
ARTICLE: 'ARTICLE',
|
||||
ASIDE: 'ASIDE',
|
||||
AUDIO: 'AUDIO',
|
||||
B: 'B',
|
||||
BASE: 'BASE',
|
||||
BASEFONT: 'BASEFONT',
|
||||
BDI: 'BDI',
|
||||
BDO: 'BDO',
|
||||
BIG: 'BIG',
|
||||
BLOCKQUOTE: 'BLOCKQUOTE',
|
||||
BODY: 'BODY',
|
||||
BR: 'BR',
|
||||
BUTTON: 'BUTTON',
|
||||
CANVAS: 'CANVAS',
|
||||
CAPTION: 'CAPTION',
|
||||
CENTER: 'CENTER',
|
||||
CITE: 'CITE',
|
||||
CODE: 'CODE',
|
||||
COL: 'COL',
|
||||
COLGROUP: 'COLGROUP',
|
||||
COMMAND: 'COMMAND',
|
||||
DATA: 'DATA',
|
||||
DATALIST: 'DATALIST',
|
||||
DD: 'DD',
|
||||
DEL: 'DEL',
|
||||
DETAILS: 'DETAILS',
|
||||
DFN: 'DFN',
|
||||
DIALOG: 'DIALOG',
|
||||
DIR: 'DIR',
|
||||
DIV: 'DIV',
|
||||
DL: 'DL',
|
||||
DT: 'DT',
|
||||
EM: 'EM',
|
||||
EMBED: 'EMBED',
|
||||
FIELDSET: 'FIELDSET',
|
||||
FIGCAPTION: 'FIGCAPTION',
|
||||
FIGURE: 'FIGURE',
|
||||
FONT: 'FONT',
|
||||
FOOTER: 'FOOTER',
|
||||
FORM: 'FORM',
|
||||
FRAME: 'FRAME',
|
||||
FRAMESET: 'FRAMESET',
|
||||
H1: 'H1',
|
||||
H2: 'H2',
|
||||
H3: 'H3',
|
||||
H4: 'H4',
|
||||
H5: 'H5',
|
||||
H6: 'H6',
|
||||
HEAD: 'HEAD',
|
||||
HEADER: 'HEADER',
|
||||
HGROUP: 'HGROUP',
|
||||
HR: 'HR',
|
||||
HTML: 'HTML',
|
||||
I: 'I',
|
||||
IFRAME: 'IFRAME',
|
||||
IMG: 'IMG',
|
||||
INPUT: 'INPUT',
|
||||
INS: 'INS',
|
||||
ISINDEX: 'ISINDEX',
|
||||
KBD: 'KBD',
|
||||
KEYGEN: 'KEYGEN',
|
||||
LABEL: 'LABEL',
|
||||
LEGEND: 'LEGEND',
|
||||
LI: 'LI',
|
||||
LINK: 'LINK',
|
||||
MAP: 'MAP',
|
||||
MARK: 'MARK',
|
||||
MATH: 'MATH',
|
||||
MENU: 'MENU',
|
||||
META: 'META',
|
||||
METER: 'METER',
|
||||
NAV: 'NAV',
|
||||
NOFRAMES: 'NOFRAMES',
|
||||
NOSCRIPT: 'NOSCRIPT',
|
||||
OBJECT: 'OBJECT',
|
||||
OL: 'OL',
|
||||
OPTGROUP: 'OPTGROUP',
|
||||
OPTION: 'OPTION',
|
||||
OUTPUT: 'OUTPUT',
|
||||
P: 'P',
|
||||
PARAM: 'PARAM',
|
||||
PRE: 'PRE',
|
||||
PROGRESS: 'PROGRESS',
|
||||
Q: 'Q',
|
||||
RP: 'RP',
|
||||
RT: 'RT',
|
||||
RUBY: 'RUBY',
|
||||
S: 'S',
|
||||
SAMP: 'SAMP',
|
||||
SCRIPT: 'SCRIPT',
|
||||
SECTION: 'SECTION',
|
||||
SELECT: 'SELECT',
|
||||
SMALL: 'SMALL',
|
||||
SOURCE: 'SOURCE',
|
||||
SPAN: 'SPAN',
|
||||
STRIKE: 'STRIKE',
|
||||
STRONG: 'STRONG',
|
||||
STYLE: 'STYLE',
|
||||
SUB: 'SUB',
|
||||
SUMMARY: 'SUMMARY',
|
||||
SUP: 'SUP',
|
||||
SVG: 'SVG',
|
||||
TABLE: 'TABLE',
|
||||
TBODY: 'TBODY',
|
||||
TD: 'TD',
|
||||
TEMPLATE: 'TEMPLATE',
|
||||
TEXTAREA: 'TEXTAREA',
|
||||
TFOOT: 'TFOOT',
|
||||
TH: 'TH',
|
||||
THEAD: 'THEAD',
|
||||
TIME: 'TIME',
|
||||
TITLE: 'TITLE',
|
||||
TR: 'TR',
|
||||
TRACK: 'TRACK',
|
||||
TT: 'TT',
|
||||
U: 'U',
|
||||
UL: 'UL',
|
||||
VAR: 'VAR',
|
||||
VIDEO: 'VIDEO',
|
||||
WBR: 'WBR'
|
||||
};
|
||||
41
resources/public/js/compiled/out/goog/dom/tags.js
Normal file
41
resources/public/js/compiled/out/goog/dom/tags.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2014 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Utilities for HTML element tag names.
|
||||
*/
|
||||
goog.provide('goog.dom.tags');
|
||||
|
||||
goog.require('goog.object');
|
||||
|
||||
|
||||
/**
|
||||
* The void elements specified by
|
||||
* http://www.w3.org/TR/html-markup/syntax.html#void-elements.
|
||||
* @const @private {!Object<string, boolean>}
|
||||
*/
|
||||
goog.dom.tags.VOID_TAGS_ = goog.object.createSet(
|
||||
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input',
|
||||
'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr');
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether the tag is void (with no contents allowed and no legal end
|
||||
* tag), for example 'br'.
|
||||
* @param {string} tagName The tag name in lower case.
|
||||
* @return {boolean}
|
||||
*/
|
||||
goog.dom.tags.isVoidTag = function(tagName) {
|
||||
return goog.dom.tags.VOID_TAGS_[tagName] === true;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue