OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file provides common methods that can be shared by other JavaScripts. | 5 // This file provides common methods that can be shared by other JavaScripts. |
6 | 6 |
7 goog.provide('__crWeb.common'); | 7 goog.provide('__crWeb.common'); |
8 | 8 |
9 goog.require('__crWeb.base'); | 9 goog.require('__crWeb.base'); |
10 | 10 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 if (trimmedName) { | 421 if (trimmedName) { |
422 trimmedName = __gCrWeb.common.trim(trimmedName); | 422 trimmedName = __gCrWeb.common.trim(trimmedName); |
423 if (trimmedName.length > 0) { | 423 if (trimmedName.length > 0) { |
424 return trimmedName; | 424 return trimmedName; |
425 } | 425 } |
426 } | 426 } |
427 trimmedName = element.getAttribute('id'); | 427 trimmedName = element.getAttribute('id'); |
428 if (trimmedName) { | 428 if (trimmedName) { |
429 return __gCrWeb.common.trim(trimmedName); | 429 return __gCrWeb.common.trim(trimmedName); |
430 } | 430 } |
431 trimmedName = element.getAttribute('autocomplete'); | |
Lei Zhang
2015/05/09 01:46:53
https://chromereviews.googleplex.com/19497013 whic
| |
432 if (trimmedName && trimmedName !== 'off') { | |
433 return __gCrWeb.common.trim(trimmedName); | |
434 } | |
435 trimmedName = element.getAttribute('placeholder'); | |
Lei Zhang
2015/05/09 01:46:53
For placeholder, AKA crbug.com/325206, upstream ev
| |
436 if (trimmedName) { | |
437 return __gCrWeb.common.trim(trimmedName); | |
438 } | |
439 return ''; | 431 return ''; |
440 }; | 432 }; |
441 | 433 |
442 /** | 434 /** |
443 * Acquires the specified DOM |attribute| from the DOM |element| and returns | 435 * Acquires the specified DOM |attribute| from the DOM |element| and returns |
444 * its lower-case value, or null if not present. | 436 * its lower-case value, or null if not present. |
445 * @param {Element} element A DOM element. | 437 * @param {Element} element A DOM element. |
446 * @param {string} attribute An attribute name. | 438 * @param {string} attribute An attribute name. |
447 * @return {?string} Lowercase value of DOM element or null if not present. | 439 * @return {?string} Lowercase value of DOM element or null if not present. |
448 */ | 440 */ |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 var plugins = findPluginNodesWithoutFallback_(); | 678 var plugins = findPluginNodesWithoutFallback_(); |
687 if (plugins.length > 0) { | 679 if (plugins.length > 0) { |
688 // Store the list of plugins in a known place for the replacement script | 680 // Store the list of plugins in a known place for the replacement script |
689 // to use, then trigger it. | 681 // to use, then trigger it. |
690 __gCrWeb['placeholderTargetPlugins'] = plugins; | 682 __gCrWeb['placeholderTargetPlugins'] = plugins; |
691 return true; | 683 return true; |
692 } | 684 } |
693 return false; | 685 return false; |
694 }; | 686 }; |
695 } // End of anonymous object | 687 } // End of anonymous object |
OLD | NEW |