Skip to content

Commit

Permalink
Merge pull request #31 from frankiefu/master
Browse files Browse the repository at this point in the history
minor updates/fixes to g-component, selector and menu
  • Loading branch information
sjmiles committed Nov 5, 2012
2 parents 63cbe38 + 0500a46 commit 60fab55
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/g-component.html
Expand Up @@ -432,7 +432,7 @@
// is in inNodes, if any
var n = inTarget;
while (n && n != this) {
var i = inNodes.indexOf(n);
var i = Array.prototype.indexOf.call(inNodes, n);
if (i >= 0) {
return i;
}
Expand Down
6 changes: 5 additions & 1 deletion src/g-menuitem.html
Expand Up @@ -5,13 +5,14 @@
* license that can be found in the LICENSE file.
*/
-->
<element name="g-menuitem" attributes="src">
<element name="g-menuitem" attributes="src, label">
<link rel="components" href="g-component.html">
<link rel="components" href="g-icon.html">
<link rel="stylesheet" href="css/g-menuitem.css" />
<template>
<g-icon id="icon"></g-icon>
<div class="label">
<span id="label"></span>
<content></content>
</div>
</template>
Expand All @@ -20,6 +21,9 @@
prototype: {
srcChanged: function() {
this.$.icon.src = this.src;
},
labelChanged: function() {
this.$.label.textContent = this.label;
}
}
});
Expand Down
12 changes: 5 additions & 7 deletions src/g-selector.html
Expand Up @@ -10,7 +10,7 @@
<link rel="components" href="g-selection.html">
<template>
<g-selection id="selection" on-select="selectionSelect" on-deselect="selectionDeselect"></g-selection>
<content id="items"></content>
<content id="items" select="*"></content>
</template>
<script>
this.component({
Expand All @@ -19,12 +19,10 @@
this.$.selection.multi = this.multi;
},
getItems: function() {
// TODO(sjmiles): distributedNodes not implemented natively yet
// this.childNodes is LightDOM fallback which works unless we
// are composited (in that case childNodes = <content>, and
// distributeNodes is necessary to find the actual distributions)
return this.$.items.getDistributedNodes() ||
Array.prototype.slice.call(this.childNodes, 0);
return this.$.items.getDistributedNodes();
},
getSelectedItem: function() {
return this.$.selection.getSelection();
},
_valueToIndex: function(inValue) {
// find an item with value == inValue and return it's index
Expand Down
2 changes: 1 addition & 1 deletion workbench/menu.html
Expand Up @@ -17,7 +17,7 @@
</style>
</head>
<body>
<g-menu>
<g-menu selected="0">
<g-menuitem src="images/edit_page.svg">Post a Comment</g-menuitem>
<g-menuitem src="images/chat.svg">Share Link</g-menuitem>
<g-menuitem src="images/email.svg">Email Link</g-menuitem>
Expand Down
4 changes: 2 additions & 2 deletions workbench/tabs.html
Expand Up @@ -6,14 +6,14 @@
<link rel="components" href="../../toolkit/src/g-tabs.html">
</head>
<body>
<g-tabs>
<g-tabs selected="0">
<span>One</span>
<span>Two</span>
<span>Three</span>
<span>Four</span>
</g-tabs>
<br><br>
<g-tabs vertical="true">
<g-tabs vertical="true" selected="0">
<span>One</span>
<span>Two</span>
<span>Three</span>
Expand Down

0 comments on commit 60fab55

Please sign in to comment.