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

Side by Side Diff: pkg/polymer/lib/elements/polymer-ui-menu-item/polymer-ui-menu-item.html

Issue 175443005: [polymer] import all elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated from bower Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!--
2 Copyright 2013 The Toolkitchen Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style
4 license that can be found in the LICENSE file.
5 -->
6 <!--
7 /**
8 * @module Polymer UI Elements
9 */
10 /**
11 * polymer-ui-menu-item is styled to look like a menu item. It should be used
12 * in conjunction with polymer-ui-menu or polymer-ui-sibebar-menu.
13 *
14 * Example:
15 *
16 * <polymer-ui-menu-item icon="settings" label="Settings"></polymer-ui-menu- item>
17 *
18 * @class polymer-ui-menu-item
19 */
20 /**
21 * The URL of an image for the icon.
22 *
23 * @attribute src
24 * @type string
25 * @default ''
26 */
27 /**
28 * Specifies the icon from the Polymer icon set.
29 *
30 * @attribute icon
31 * @type string
32 * @default ''
33 */
34 /**
35 * Specifies the label for the menu item.
36 *
37 * @attribute label
38 * @type string
39 * @default ''
40 */
41 /**
42 * Specifies the URL of the link it goes to when tapped on.
43 *
44 * Example:
45 *
46 * <polymer-ui-menu-item icon="favorite" label="Favorite" href="http://www.p olymer-project.org/"></polymer-ui-menu-item>
47 *
48 * If you want more control on the link, e.g. specify the target for where to
49 * open the linked document, you can put &lt;a> directly inside the menu-item.
50 *
51 * Example:
52 *
53 * <polymer-ui-menu-item icon="favorite" label="Favorite">
54 * <a href="http://www.polymer-project.org/" target="_self"></a>
55 * </polymer-ui-menu-item>
56 *
57 * @attribute href
58 * @type string
59 * @default ''
60 */
61 -->
62 <link rel="import" href="../polymer/polymer.html">
63 <link rel="import" href="../polymer-ui-icon/polymer-ui-icon.html">
64 <link rel="import" href="../polymer-ui-theme-aware/polymer-ui-theme-aware.html">
65
66 <polymer-element name="polymer-ui-menu-item" extends="polymer-ui-theme-aware" at tributes="src label icon item href">
67 <template>
68 <link rel="stylesheet" href="polymer-ui-menu-item.css">
69 <polymer-ui-icon src="{{src}}" icon="{{icon}}" showing?="{{icon || src}}"></ polymer-ui-icon>
70 <span id="label">{{label}}<content></content></span>
71 <a id="link" href="{{href}}" hidden?="{{!href}}"></a>
72 </template>
73 <script>
74 Polymer('polymer-ui-menu-item', {
75 label: '',
76 // calc item's offset middle pos instead of using offsetTop/Height
77 // directly which requires to wait for submenu's collapsing transition to
78 // complete first before it can return the correct pos.
79 getOffsetMiddle: function() {
80 var p = this.parentNode;
81 if (p) {
82 var i = Array.prototype.indexOf.call(p.items, this);
83 var h = this.getItemHeight();
84 return i * h + h/2 + p.items[0].offsetTop;
85 }
86 },
87 getItemHeight: function() {
88 return this.offsetHeight;
89 }
90 });
91 </script>
92 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698