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

Unified Diff: polymer_0.5.0/bower_components/core-input/core-input.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 12 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: polymer_0.5.0/bower_components/core-input/core-input.html
diff --git a/polymer_0.5.0/bower_components/core-input/core-input.html b/polymer_0.5.0/bower_components/core-input/core-input.html
new file mode 100644
index 0000000000000000000000000000000000000000..04805bb42681d098f8550473f2036f52090ea3c4
--- /dev/null
+++ b/polymer_0.5.0/bower_components/core-input/core-input.html
@@ -0,0 +1,148 @@
+<!--
+Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
+The complete set of authors may be found at http://polymer.github.io/AUTHORS
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
+-->
+
+<!--
+
+`core-input` is an unstyled single-line input field. It extends the native
+`input` element.
+
+Example:
+
+ <input is="core-input">
+
+The input's value is considered "committed" if the user hits the "enter" key
+or blurs the input after changing the value. The committed value is stored in
+the `committedValue` property.
+
+If the input has `type = number`, this element will also prevent non-numeric characters
+from being typed into the text field.
+
+Accessibility
+-------------
+
+The following ARIA attributes are set automatically:
+
+- `aria-label`: set to the `placeholder` attribute
+- `aria-disabled`: set if `disabled` is true
+
+@group Polymer Core Elements
+@element core-input
+@extends input
+@homepage github.io
+-->
+<link href="../polymer/polymer.html" rel="import">
+
+<style shim-shadowdom>
+ /* FIXME consider theming */
+
+ html /deep/ input[is=core-input] {
+ width: 20em;
+ font: inherit;
+ margin: 0;
+ padding: 0;
+ background-color: transparent;
+ border: 0;
+ outline: none;
+ }
+</style>
+
+<polymer-element name="core-input" extends="input">
+
+<script>
+
+ Polymer('core-input', {
+
+ publish: {
+
+ /**
+ * The "committed" value of the input, ie. the input value when the user
+ * hits the "enter" key or blurs the input after changing the value. You
+ * can bind to this value instead of listening for the "change" event.
+ * Setting this property has no effect on the input value.
+ *
+ * @attribute committedValue
+ * @type string
+ * @default ''
+ */
+ committedValue: '',
+
+ /**
+ * Set to true to prevent invalid input from being entered.
+ *
+ * @attribute preventInvalidInput
+ * @type boolean
+ * @default false
+ */
+ preventInvalidInput: false
+
+ },
+
+ previousValidInput: '',
+
+ eventDelegates: {
+ input: 'inputAction',
+ change: 'changeAction'
+ },
+
+ ready: function() {
+ /* set ARIA attributes */
+ this.disabledHandler();
+ this.placeholderHandler();
+ },
+
+ attributeChanged: function(attr, old) {
+ if (this[attr + 'Handler']) {
+ this[attr + 'Handler'](old);
+ }
+ },
+
+ disabledHandler: function() {
+ if (this.disabled) {
+ this.setAttribute('aria-disabled', '');
+ } else {
+ this.removeAttribute('aria-disabled');
+ }
+ },
+
+ placeholderHandler: function() {
+ if (this.placeholder) {
+ this.setAttribute('aria-label', this.placeholder);
+ } else {
+ this.removeAttribute('aria-label');
+ }
+ },
+
+ /**
+ * Commits the `value` to `committedValue`
+ *
+ * @method commit
+ */
+ commit: function() {
+ this.committedValue = this.value;
+ },
+
+ changeAction: function() {
+ this.commit();
+ },
+
+ inputAction: function(e) {
+ if (this.preventInvalidInput) {
+ if (!e.target.validity.valid) {
+ e.target.value = this.previousValidInput;
+ } else {
+ this.previousValidInput = e.target.value;
+ }
+ }
+ }
+
+ });
+
+</script>
+
+</polymer-element>
« no previous file with comments | « polymer_0.5.0/bower_components/core-input/core-input.css ('k') | polymer_0.5.0/bower_components/core-input/demo.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698