Closed
Bug 209885
Opened 22 years ago
Closed 22 years ago
Support <tab linkedpanel="panelId"/>
Categories
(Core :: XUL, enhancement)
Core
XUL
Tracking
()
RESOLVED
FIXED
People
(Reporter: WeirdAl, Assigned: WeirdAl)
References
()
Details
Attachments
(3 files, 3 obsolete files)
2.70 KB,
application/vnd.mozilla.xul+xml
|
Details | |
2.19 KB,
patch
|
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
2.06 KB,
patch
|
Details | Diff | Splinter Review |
We should support a panel attribute for the <xul:tab/> element, where the panel
designated an appropriate <xul:tabpanel/> element. The idea is multiple tabs
should be able to reference a single tabpanel, and use event listeners to apply
style sheets, etc. to that tabpanel.
This RFE started as an e-mail I sent to jag, rginda, and glazman, and has picked
up significant interest in 24 hours. Hence, this bug.
I truly believe the fix for this will be trivial to implement.
Assignee | ||
Comment 1•22 years ago
|
||
Assignee | ||
Comment 2•22 years ago
|
||
This patch implements a linkedPanel attribute and corresponding property for
the <xul:tab/> element.
Assignee | ||
Updated•22 years ago
|
Attachment #126080 -
Flags: superreview?(jaggernaut)
Attachment #126080 -
Flags: review?(timeless)
Assignee | ||
Comment 3•22 years ago
|
||
I decided to call it "linkedPanel" instead of "panel" to avoid confusion with
the <xul:tabpanel/> element.
Summary: Support <tab panel="panelId"/> → Support <tab linkedPanel="panelId"/>
Assignee | ||
Comment 4•22 years ago
|
||
jag: timeless wants your sr+/- on this before he gives r+/-.
I'm having second thoughts about something in the patch, the linkedPanel setter.
Do we really want a setter? If so, what if the panel doesn't have an id?
Comment 5•22 years ago
|
||
Alternatively, have the linked panel be a field, rather than a property.
Initialize it in the constructor (compare _eventNode).
Comment 6•22 years ago
|
||
Is there any code that goes back from selected panel to selected tab and now
won't know which tab to select?
Assignee | ||
Comment 7•22 years ago
|
||
jag: I hope not, since that pretty much implies infinite recursion (tab sets
tabpanel, which sets tab, which sets tabpanel...) More specifically, there is
no binding for <xul:tabpanel/> elements. I think we're okay on that.
neil: good idea, but I would be more comfortable setting <xul:tab/>'s
_linkedPanel property from the <xul:tabbox/>'s constructor. Reason: we cannot
tell whether
<xul:tabbox>
<xul:tabs>
<xul:tab/>
</xul:tabs>
<xul:tabpanels>
<xul:tabpanel/>
</xul:tabpanels>
</xul:tabbox>
or
<xul:tabbox>
<xul:tabpanels>
<xul:tabpanel/>
</xul:tabpanels>
<xul:tabs>
<xul:tab/>
</xul:tabs>
</xul:tabbox>
I've found the order of bindings' constructors firing sometimes matters. Opinion?
Assignee | ||
Comment 8•22 years ago
|
||
Comment on attachment 126080 [details]
patch, v1
patch v2 coming up in 15 seconds.
Attachment #126080 -
Attachment is obsolete: true
Attachment #126080 -
Attachment is patch: false
Attachment #126080 -
Flags: superreview?(jaggernaut)
Attachment #126080 -
Flags: review?(timeless)
Assignee | ||
Comment 9•22 years ago
|
||
Assignee | ||
Updated•22 years ago
|
Attachment #126875 -
Flags: superreview?(jaggernaut)
Attachment #126875 -
Flags: review?(timeless)
Comment 10•22 years ago
|
||
Comment on attachment 126875 [details] [diff] [review]
patch, v2
>+ for (var i = 0; i < this._tabpanels.childNodes.length; i++) {
We like to save the childNodes result in a temporary variable (it's a computed
property).
>+ var panel = this._tabpanels.childNodes.item(i);
What's wrong with [i]?
>+ if (panel.id) {
>+ panelsById[panel.id] = panel;
>+ }
Hmm... what's brace style around here?
>+ if (linkedPanelId) {
>+ if (typeof panelsById[linkedPanelId] == "object") {
You can use if (linkPanelID in panelsById) here.
>+ if (linkedPanel == null) {
>- tabpanels.selectedIndex = val;
>+ tabpanels.selectedIndex = val;
>+ } else {
>+ tabpanels.selectedPanel = linkedPanel;
>+ }
Reverse the clauses and use if (linkedPanel) instead?
Assignee | ||
Comment 11•22 years ago
|
||
Re Neil's comment 10: Okay, I've fixed all the sections you refer to. caillon
explained to me brace style refers to consistency for braces throughout the
document. In tabbox.xml, one-line statements belonging to conditional and
looping statements don't use braces, so I've got that straightened out.
Other commentary? The changes are quite minor; if you want the revised patch I
can post it.
jag: I've confirmed setting a tabpanel as selected does not affect the tabs.
Assignee | ||
Comment 12•22 years ago
|
||
Comment on attachment 126875 [details] [diff] [review]
patch, v2
reassigning r? based on jag's advice.
Attachment #126875 -
Flags: review?(timeless) → review?(neil.parkwaycc.co.uk)
Comment 13•22 years ago
|
||
Comment on attachment 126875 [details] [diff] [review]
patch, v2
I think the xul styleguide says all attributes should be completely lowercase,
so "linkedpanel".
This code doesn't deal well with tabs / panels dynamically being added/removed.
If you want to deal with that, I think it'd be okay to do
document.getElementById(tabs[val].getAttribute("selectedpanel")) to get the
panel to show (and if that returns null, do tabpanels.selectedIndex = val)
Attachment #126875 -
Flags: review?(neil.parkwaycc.co.uk) → review?(timeless)
Comment 14•22 years ago
|
||
Not forgetting to check for hasAttribute first, of course :-)
Comment 15•22 years ago
|
||
Neil: of course, null checks are needed in the above suggestion :-)
Comment 16•22 years ago
|
||
Comment on attachment 126875 [details] [diff] [review]
patch, v2
Marking -. ajvincent and I discussed a new approach on irc and he'll come up
with a patch soonish.
Attachment #126875 -
Flags: superreview?(jaggernaut)
Attachment #126875 -
Flags: superreview-
Attachment #126875 -
Flags: review?(timeless)
Assignee | ||
Comment 17•22 years ago
|
||
Now using lowercase linkedpanel attribute.
Attachment #126079 -
Attachment is obsolete: true
Assignee | ||
Comment 18•22 years ago
|
||
answering jag's concerns as voiced on irc.
Attachment #126875 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Attachment #127701 -
Flags: superreview?(jaggernaut)
Attachment #127701 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 19•22 years ago
|
||
Comment on attachment 127701 [details] [diff] [review]
patch, v3
>+ var linkedPanelId = tabs[val].linkedPanel
Dropped a ;
>+ if (linkedPanelId)
>+ var linkedPanel = document.getElementById(linkedPanelId);
>+ else
>+ linkedPanel = null;
"Badly" scoped var - although JS uses function scope humans use block scope,
easiest fix should be to use ?: operator instead of if/else.
Assignee | ||
Comment 20•22 years ago
|
||
neil: ok, I'll fix that. Anything else I should change to get an r+/-?
Comment 21•22 years ago
|
||
No, I think that's all, thanks.
Comment 22•22 years ago
|
||
Comment on attachment 127701 [details] [diff] [review]
patch, v3
sr=jag with Neil's comments addressed
Attachment #127701 -
Flags: superreview?(jaggernaut) → superreview+
Assignee | ||
Comment 23•22 years ago
|
||
patch conforming to neil r+, jag sr+
Assignee | ||
Comment 24•22 years ago
|
||
patch checked in by jag.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Summary: Support <tab linkedPanel="panelId"/> → Support <tab linkedpanel="panelId"/>
Assignee | ||
Updated•21 years ago
|
Attachment #127701 -
Flags: review?(neil.parkwaycc.co.uk)
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•