| OLD | NEW |
| (Empty) |
| 1 <!-- Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 Use of this source code is governed by a BSD-style license that can be | |
| 3 found in the LICENSE file. --> | |
| 4 | |
| 5 <!-- | |
| 6 This is similar to a button, but appears like a link instead. It's generally | |
| 7 for non-destructive actions and should never navigate the page. | |
| 8 | |
| 9 ex. <a is="cr-action" on-tap="{{ doSomething }}"></a> | |
| 10 | |
| 11 Note: This element is very common on typical pages so it's been micro | |
| 12 optimized to not contain any whitespace and not use data binding in the | |
| 13 template. | |
| 14 --> | |
| 15 <polymer-element name="cr-action" extends="a" on-keyup="{{ handleKeyup }}" on-cl
ick="{{ handleClick }}"> | |
| 16 <template><style> | |
| 17 :host { | |
| 18 color: #1155CC; | |
| 19 cursor: pointer; | |
| 20 display: inline-block; | |
| 21 text-decoration: none; | |
| 22 -webkit-user-select: none; | |
| 23 } | |
| 24 | |
| 25 :host(:hover) { | |
| 26 text-decoration: underline; | |
| 27 } | |
| 28 </style><content></content></template> | |
| 29 <script> | |
| 30 Polymer("cr-action", { | |
| 31 created: function() { | |
| 32 this.href = "/#"; | |
| 33 }, | |
| 34 handleKeyup: function(event) { | |
| 35 // Enter and spacebar keys | |
| 36 if (event.keyCode == 13 || event.keyCode == 32) { | |
| 37 this.fire("tap"); | |
| 38 event.preventDefault(); | |
| 39 } | |
| 40 }, | |
| 41 handleClick: function(event) { | |
| 42 event.preventDefault(); | |
| 43 }, | |
| 44 }); | |
| 45 </script> | |
| 46 </ploymer-element> | |
| OLD | NEW |