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

Unified Diff: third_party/polymer/components-chromium/core-icon/core-icon-extracted.js

Issue 1215543002: Remove Polymer 0.5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 5 years, 6 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/polymer/components-chromium/core-icon/core-icon-extracted.js
diff --git a/third_party/polymer/components-chromium/core-icon/core-icon-extracted.js b/third_party/polymer/components-chromium/core-icon/core-icon-extracted.js
deleted file mode 100644
index 86ddf0e878c9c8f4467b7217bb686ce2074d87f2..0000000000000000000000000000000000000000
--- a/third_party/polymer/components-chromium/core-icon/core-icon-extracted.js
+++ /dev/null
@@ -1,137 +0,0 @@
-
-(function() {
-
- // mono-state
- var meta;
-
- Polymer('core-icon', {
-
- /**
- * The URL of an image for the icon. If the src property is specified,
- * the icon property should not be.
- *
- * @attribute src
- * @type string
- * @default ''
- */
- src: '',
-
- /**
- * Specifies the icon name or index in the set of icons available in
- * the icon's icon set. If the icon property is specified,
- * the src property should not be.
- *
- * @attribute icon
- * @type string
- * @default ''
- */
- icon: '',
-
- /**
- * Alternative text content for accessibility support.
- * If alt is present and not empty, it will set the element's role to img and add an aria-label whose content matches alt.
- * If alt is present and is an empty string, '', it will hide the element from the accessibility layer
- * If alt is not present, it will set the element's role to img and the element will fallback to using the icon attribute for its aria-label.
- *
- * @attribute alt
- * @type string
- * @default ''
- */
- alt: null,
-
- observe: {
- 'icon': 'updateIcon',
- 'alt': 'updateAlt'
- },
-
- defaultIconset: 'icons',
-
- ready: function() {
- if (!meta) {
- meta = document.createElement('core-iconset');
- }
-
- // Allow user-provided `aria-label` in preference to any other text alternative.
- if (this.hasAttribute('aria-label')) {
- // Set `role` if it has not been overridden.
- if (!this.hasAttribute('role')) {
- this.setAttribute('role', 'img');
- }
- return;
- }
- this.updateAlt();
- },
-
- srcChanged: function() {
- var icon = this._icon || document.createElement('div');
- icon.textContent = '';
- icon.setAttribute('fit', '');
- icon.style.backgroundImage = 'url(' + this.src + ')';
- icon.style.backgroundPosition = 'center';
- icon.style.backgroundSize = '100%';
- if (!icon.parentNode) {
- this.appendChild(icon);
- }
- this._icon = icon;
- },
-
- getIconset: function(name) {
- return meta.byId(name || this.defaultIconset);
- },
-
- updateIcon: function(oldVal, newVal) {
- if (!this.icon) {
- this.updateAlt();
- return;
- }
- var parts = String(this.icon).split(':');
- var icon = parts.pop();
- if (icon) {
- var set = this.getIconset(parts.pop());
- if (set) {
- this._icon = set.applyIcon(this, icon);
- if (this._icon) {
- this._icon.setAttribute('fit', '');
- }
- }
- }
- // Check to see if we're using the old icon's name for our a11y fallback
- if (oldVal) {
- if (oldVal.split(':').pop() == this.getAttribute('aria-label')) {
- this.updateAlt();
- }
- }
- },
-
- updateAlt: function() {
- // Respect the user's decision to remove this element from
- // the a11y tree
- if (this.getAttribute('aria-hidden')) {
- return;
- }
-
- // Remove element from a11y tree if `alt` is empty, otherwise
- // use `alt` as `aria-label`.
- if (this.alt === '') {
- this.setAttribute('aria-hidden', 'true');
- if (this.hasAttribute('role')) {
- this.removeAttribute('role');
- }
- if (this.hasAttribute('aria-label')) {
- this.removeAttribute('aria-label');
- }
- } else {
- this.setAttribute('aria-label', this.alt ||
- this.icon.split(':').pop());
- if (!this.hasAttribute('role')) {
- this.setAttribute('role', 'img');
- }
- if (this.hasAttribute('aria-hidden')) {
- this.removeAttribute('aria-hidden');
- }
- }
- }
-
- });
-
-})();

Powered by Google App Engine
This is Rietveld 408576698