OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('cr.ui', function() { | 5 cr.define('cr.ui', function() { |
6 | 6 |
7 /** | 7 /** |
8 * Returns the TabBox for a Tab or a TabPanel. | 8 * Returns the TabBox for a Tab or a TabPanel. |
9 * @param {Tab|TabPanel} el The tab or tabpanel element. | 9 * @param {Tab|TabPanel} el The tab or tabpanel element. |
10 * @return {TabBox} The tab box if found. | 10 * @return {TabBox} The tab box if found. |
11 */ | 11 */ |
12 function getTabBox(el) { | 12 function getTabBox(el) { |
13 return findAncestor( | 13 return findAncestor(el, function(node) { |
14 el, function(node) { return node.tagName == 'TABBOX'; }); | 14 return node.tagName == 'TABBOX'; |
| 15 }); |
15 } | 16 } |
16 | 17 |
17 /** | 18 /** |
18 * Returns whether an element is a tab related object. | 19 * Returns whether an element is a tab related object. |
19 * @param {HTMLElement} el The element whose tag is being checked | 20 * @param {HTMLElement} el The element whose tag is being checked |
20 * @return {boolean} Whether the element is a tab related element. | 21 * @return {boolean} Whether the element is a tab related element. |
21 */ | 22 */ |
22 function isTabElement(el) { | 23 function isTabElement(el) { |
23 return el.tagName == 'TAB' || el.tagName == 'TABPANEL'; | 24 return el.tagName == 'TAB' || el.tagName == 'TABPANEL'; |
24 } | 25 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 cr.defineProperty(TabPanel, 'selected', cr.PropertyKind.BOOL_ATTR); | 232 cr.defineProperty(TabPanel, 'selected', cr.PropertyKind.BOOL_ATTR); |
232 | 233 |
233 return { | 234 return { |
234 TabBox: TabBox, | 235 TabBox: TabBox, |
235 Tabs: Tabs, | 236 Tabs: Tabs, |
236 Tab: Tab, | 237 Tab: Tab, |
237 TabPanels: TabPanels, | 238 TabPanels: TabPanels, |
238 TabPanel: TabPanel | 239 TabPanel: TabPanel |
239 }; | 240 }; |
240 }); | 241 }); |
OLD | NEW |