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

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

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 years, 3 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-dropdown/core-dropdown-extracted.js
diff --git a/third_party/polymer/components-chromium/core-dropdown/core-dropdown-extracted.js b/third_party/polymer/components-chromium/core-dropdown/core-dropdown-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..f44acb8b3df28c270f33f897c42aebb7c0dcd526
--- /dev/null
+++ b/third_party/polymer/components-chromium/core-dropdown/core-dropdown-extracted.js
@@ -0,0 +1,125 @@
+
+
+ Polymer('core-dropdown',{
+
+ publish: {
+
+ /**
+ * True if the menu is open.
+ *
+ * @attribute opened
+ * @type boolean
+ * @default false
+ */
+ opened: false,
+
+ /**
+ * A label for the control. The label is displayed if no item is selected.
+ *
+ * @attribute label
+ * @type string
+ * @default 'Select an item'
+ */
+ label: 'Select an item',
+
+ /**
+ * The currently selected element. By default this is the index of the item element.
+ * If you want a specific attribute value of the element to be used instead of the
+ * index, set `valueattr` to that attribute name.
+ *
+ * @attribute selected
+ * @type Object
+ * @default null
+ */
+ selected: null,
+
+ /**
+ * Specifies the attribute to be used for "selected" attribute.
+ *
+ * @attribute valueattr
+ * @type string
+ * @default 'name'
+ */
+ valueattr: 'name',
+
+ /**
+ * Specifies the CSS class to be used to add to the selected element.
+ *
+ * @attribute selectedClass
+ * @type string
+ * @default 'core-selected'
+ */
+ selectedClass: 'core-selected',
+
+ /**
+ * Specifies the property to be used to set on the selected element
+ * to indicate its active state.
+ *
+ * @attribute selectedProperty
+ * @type string
+ * @default ''
+ */
+ selectedProperty: '',
+
+ /**
+ * Specifies the attribute to set on the selected element to indicate
+ * its active state.
+ *
+ * @attribute selectedAttribute
+ * @type string
+ * @default 'active'
+ */
+ selectedAttribute: 'selected',
+
+ /**
+ * The currently selected element.
+ *
+ * @attribute selectedItem
+ * @type Object
+ * @default null
+ */
+ selectedItem: null,
+
+ /**
+ * Horizontally align the overlay with the control.
+ * @attribute halign
+ * @type "left"|"right"
+ * @default "left"
+ */
+ halign: {value: 'left', reflect: true},
+
+ /**
+ * Vertically align the dropdown menu with the control.
+ * @attribute valign
+ * @type "top"|"bottom"
+ * @default "bottom"
+ */
+ valign: {value: 'bottom', reflect: true}
+
+ },
+
+ toggle: function() {
+ this.opened = !this.opened;
+ },
+
+ openAction: function(e) {
+ if (e.detail) {
+ var rect = this.$.control.getBoundingClientRect();
+ if (this.valign === 'top') {
+ this.$.menu.style.top = 'auto';
+ this.$.menu.style.bottom = rect.height + 'px';
+ this.$.menu.style.maxHeight = (window.innerHeight - (window.innerHeight - rect.top) - 12) + 'px';
+ } else {
+ this.$.menu.style.top = rect.height + 'px';
+ this.$.menu.style.bottom = 'auto';
+ this.$.menu.style.maxHeight = (window.innerHeight - rect.height - rect.top - 12) + 'px';
+ }
+ this.$.menu.style.minWidth = rect.width + 'px';
+ }
+ },
+
+ selectAction: function() {
+ this.opened = false;
+ }
+ });
+

Powered by Google App Engine
This is Rietveld 408576698