:last-of-type instead of [last-tab]

Discuss application theming and theme development.

User avatar
Posts: 23734
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC

Post Posted December 29th, 2013, 3:12 pm

I'm aware that [first-tab] and [last-tab] attribute selectors have been broken in Firefox ever since the implementation of TabGroups and Pinned Tabs. However, I assumed that they correctly worked in SeaMonkey. Unfortunately they do not. On startup [last-tab] fails pretty often. In fact, on browser open it appears to be assigning whatever tab is *selected* as the [last-tab] even if it quite obviously isn't. This is unfortunate because one use of these selectors is to style the corners of tabs differently. Another use would be to make a solitary tab look different (for instance, hide the close button like in Firefox). I will probably file a bug about this but I just wanted to share the rather simple workaround.

Instead of [first-tab] and [last-tab] attributes, use :first-of-type and :last-of-type pseudo-class selectors. So to get a solitary tab, instead of using:

tab[first-tab][last-tab] { code }

I'm using:

tab:first-of-type:last-of-type { code }

Nice and simple. I'm not using :first-child and :last-child because SeaMonkey's tab strip has spacer elements in it. That method would also be inflexible to insertion of elements by extensions. I hadn't heard of anyone using :first-of-type or :last-of-type yet, so I thought you guys might find it interesting. ... st-of-type
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about:

Return to Theme Development

Who is online

Users browsing this forum: No registered users and 1 guest