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

Side by Side Diff: third_party/polymer/components/iron-input/iron-input.html

Issue 3010683002: Update Polymer components. (Closed)
Patch Set: Rebase Created 3 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 unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --> 9 -->
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 value: false 101 value: false
102 } 102 }
103 103
104 }, 104 },
105 105
106 listeners: { 106 listeners: {
107 'input': '_onInput', 107 'input': '_onInput',
108 'keypress': '_onKeypress' 108 'keypress': '_onKeypress'
109 }, 109 },
110 110
111 /** @suppress {checkTypes} */
112 registered: function() { 111 registered: function() {
113 // Feature detect whether we need to patch dispatchEvent (i.e. on FF and I E). 112 // Feature detect whether we need to patch dispatchEvent (i.e. on FF and I E).
114 if (!this._canDispatchEventOnDisabled()) { 113 if (!this._canDispatchEventOnDisabled()) {
115 this._origDispatchEvent = this.dispatchEvent; 114 this._origDispatchEvent = this.dispatchEvent;
116 this.dispatchEvent = this._dispatchEventFirefoxIE; 115 this.dispatchEvent = this._dispatchEventFirefoxIE;
117 } 116 }
118 }, 117 },
119 118
120 created: function() { 119 created: function() {
121 Polymer.IronA11yAnnouncer.requestAvailability(); 120 Polymer.IronA11yAnnouncer.requestAvailability();
122 }, 121 },
123 122
124 _canDispatchEventOnDisabled: function() { 123 _canDispatchEventOnDisabled: function() {
125 var input = document.createElement('input'); 124 var input = document.createElement('input');
126 var canDispatch = false; 125 var canDispatch = false;
127 input.disabled = true; 126 input.disabled = true;
128 127
129 input.addEventListener('feature-check-dispatch-event', function() { 128 input.addEventListener('feature-check-dispatch-event', function() {
130 canDispatch = true; 129 canDispatch = true;
131 }); 130 });
132 131
133 try { 132 try {
134 input.dispatchEvent(new Event('feature-check-dispatch-event')); 133 input.dispatchEvent(new Event('feature-check-dispatch-event'));
135 } catch(e) {} 134 } catch(e) {}
136 135
137 return canDispatch; 136 return canDispatch;
138 }, 137 },
139 138
140 _dispatchEventFirefoxIE: function() { 139 /**
140 * @this {Node}
141 * @param {!Event} event
142 * @return {boolean}
143 */
144 _dispatchEventFirefoxIE: function(event) {
141 // Due to Firefox bug, events fired on disabled form controls can throw 145 // Due to Firefox bug, events fired on disabled form controls can throw
142 // errors; furthermore, neither IE nor Firefox will actually dispatch 146 // errors; furthermore, neither IE nor Firefox will actually dispatch
143 // events from disabled form controls; as such, we toggle disable around 147 // events from disabled form controls; as such, we toggle disable around
144 // the dispatch to allow notifying properties to notify 148 // the dispatch to allow notifying properties to notify
145 // See issue #47 for details 149 // See issue #47 for details
146 var disabled = this.disabled; 150 var disabled = this.disabled;
147 this.disabled = false; 151 this.disabled = false;
148 this._origDispatchEvent.apply(this, arguments); 152 var defaultPrevented = this._origDispatchEvent(event);
149 this.disabled = disabled; 153 this.disabled = disabled;
154 return defaultPrevented
150 }, 155 },
151 156
152 get _patternRegExp() { 157 get _patternRegExp() {
153 var pattern; 158 var pattern;
154 if (this.allowedPattern) { 159 if (this.allowedPattern) {
155 pattern = new RegExp(this.allowedPattern); 160 pattern = new RegExp(this.allowedPattern);
156 } else { 161 } else {
157 switch (this.type) { 162 switch (this.type) {
158 case 'number': 163 case 'number':
159 pattern = /[0-9.,e-]/; 164 pattern = /[0-9.,e-]/;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 this.fire('iron-announce', { text: message }); 302 this.fire('iron-announce', { text: message });
298 } 303 }
299 }); 304 });
300 305
301 /* 306 /*
302 The `iron-input-validate` event is fired whenever `validate()` is called. 307 The `iron-input-validate` event is fired whenever `validate()` is called.
303 @event iron-input-validate 308 @event iron-input-validate
304 */ 309 */
305 310
306 </script> 311 </script>
OLDNEW
« no previous file with comments | « third_party/polymer/components/iron-input/bower.json ('k') | third_party/polymer/components/iron-location/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698