Skip to content

Commit 60fab55

Browse files
committed
Merge pull request #31 from frankiefu/master
minor updates/fixes to g-component, selector and menu
2 parents 63cbe38 + 0500a46 commit 60fab55

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

src/g-component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
// is in inNodes, if any
433433
var n = inTarget;
434434
while (n && n != this) {
435-
var i = inNodes.indexOf(n);
435+
var i = Array.prototype.indexOf.call(inNodes, n);
436436
if (i >= 0) {
437437
return i;
438438
}

src/g-menuitem.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
* license that can be found in the LICENSE file.
66
*/
77
-->
8-
<element name="g-menuitem" attributes="src">
8+
<element name="g-menuitem" attributes="src, label">
99
<link rel="components" href="g-component.html">
1010
<link rel="components" href="g-icon.html">
1111
<link rel="stylesheet" href="css/g-menuitem.css" />
1212
<template>
1313
<g-icon id="icon"></g-icon>
1414
<div class="label">
15+
<span id="label"></span>
1516
<content></content>
1617
</div>
1718
</template>
@@ -20,6 +21,9 @@
2021
prototype: {
2122
srcChanged: function() {
2223
this.$.icon.src = this.src;
24+
},
25+
labelChanged: function() {
26+
this.$.label.textContent = this.label;
2327
}
2428
}
2529
});

src/g-selector.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel="components" href="g-selection.html">
1111
<template>
1212
<g-selection id="selection" on-select="selectionSelect" on-deselect="selectionDeselect"></g-selection>
13-
<content id="items"></content>
13+
<content id="items" select="*"></content>
1414
</template>
1515
<script>
1616
this.component({
@@ -19,12 +19,10 @@
1919
this.$.selection.multi = this.multi;
2020
},
2121
getItems: function() {
22-
// TODO(sjmiles): distributedNodes not implemented natively yet
23-
// this.childNodes is LightDOM fallback which works unless we
24-
// are composited (in that case childNodes = <content>, and
25-
// distributeNodes is necessary to find the actual distributions)
26-
return this.$.items.getDistributedNodes() ||
27-
Array.prototype.slice.call(this.childNodes, 0);
22+
return this.$.items.getDistributedNodes();
23+
},
24+
getSelectedItem: function() {
25+
return this.$.selection.getSelection();
2826
},
2927
_valueToIndex: function(inValue) {
3028
// find an item with value == inValue and return it's index

workbench/menu.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</style>
1818
</head>
1919
<body>
20-
<g-menu>
20+
<g-menu selected="0">
2121
<g-menuitem src="images/edit_page.svg">Post a Comment</g-menuitem>
2222
<g-menuitem src="images/chat.svg">Share Link</g-menuitem>
2323
<g-menuitem src="images/email.svg">Email Link</g-menuitem>

workbench/tabs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<link rel="components" href="../../toolkit/src/g-tabs.html">
77
</head>
88
<body>
9-
<g-tabs>
9+
<g-tabs selected="0">
1010
<span>One</span>
1111
<span>Two</span>
1212
<span>Three</span>
1313
<span>Four</span>
1414
</g-tabs>
1515
<br><br>
16-
<g-tabs vertical="true">
16+
<g-tabs vertical="true" selected="0">
1717
<span>One</span>
1818
<span>Two</span>
1919
<span>Three</span>

0 commit comments

Comments
 (0)