Get access to the selected tab

How can I get access to the selected tab?

$ = require "ko/dom"
log = require("ko/logging").getLogger "tabstatus-logger"
obj = $ "#topview #tabbed-view tab[type='file-tab'][selected=true]"
obj.css "background", "#ff0000"

This code doesn’t work (I know that it’s CoffeeScript, I’ve compiled it to JS)
Also to be clarify - I’m trying to do that from my add-on.

You can’t access anonymous nodes that way from JS, you have to get creative with what the XUL binding is exposing to you. Using DOM inspector to inspect XBL and the JavaScript object is useful here, as well as just using the javaScript shell to delve down into objects.

Here’s what you want:

var selectedTab = ko.views.manager.currentView.parentView.tabbox.selectedTab;
selectedTab.setAttribute("style", "background: #ff0000");

Because Mozilla? :stuck_out_tongue:

Something like that? :smiley:

#topview > box > view#view-1 > tabbox#tabbed-view > tabs > vbox > box > arrowscrollbox > scrollbox > box > tab ?

I’m not following your logic there, that looks like a really convoluted CSS rule. You dont need to do any trickery to access anonymous elements through CSS, only when accessing them through JS.

I don’t understand how that can help me.