XBL Replacement Newsletter 3
This is the third edition of the XBL Replacement Newsletter. Since the last update, we’ve removed 27 bindings and have been preparing to migrate bindings to Custom Elements.
Just a reminder that easiest way to follow along with the work is to follow the main meta bug. If you’d like to help, we are tagging bugs that are unblocked and ready to be worked on with xbl-available.
Custom Elements
Custom Elements have been enabled in Nightly by default, which is a big step towards being able to use them in the browser chrome. Mossop has landed initial Custom Element support for XUL elements, and we have a couple of follow-ups on file before we can start using them. We are also working to find the best way to include Custom Element scripts (bug 1411707) and styles (bug 1420229) in XUL documents.
Accessibility Roles
One of the features that XBL provides is a way to assign a ‘role’ to elements that have a particular binding attached. For example: <binding id="toolbar" role="xul:toolbar">
will attach the XULToolbarAccessible class to all toolbar
elements with that binding attached.
We needed to come up with a new solution to continue supporting the accessibility roles, and initial work for that landed in bug 1403231 when we removed the image
binding. This created a new XULMap.h file in which tag names get mapped to roles. The current implementation won’t handle every case, like when bindings are attached using more complex CSS selectors, but Paolo has done a thorough analysis of which bindings we can migrate right away.
Binding Removals
There are 240 more bindings left, down from 300 at the start of the project. We’ve also started to put a dent in the number of lines of code, passing below 90%. Here's a list of the changes:
- Myk Melez removed the
preferences
,preference
,prefwindow
,prefpane
, andpanebutton
bindings from about:preferences, migrating them to vanilla JS and validating the JS module approach to removing certain types of bindings. - Tim Nguyen (ntim) discovered and removed some unused date and timepicker bindings and deleted ~2K LOC.
- ntim also discovered and removed a bunch of legacy toolbar customization code (another 2K LOC), which didn’t delete any bindings but did remove quite a bit of XBL code.
- Paolo Amadini removed the
addengine-icon
binding in the search popup, which in turn allowed the button to reuse the existing ‘add’ SVG icon instead of custom PNG versions. - Paolo also removed the
panelview
binding, creating the equivalent markup inside the existing PanelMultiView.jsm navigation functions. - 86ecce74 removed the unused
button-image
binding. - 86ecce74 also removed the unused
expander
binding and associated UA styles. - 86ecce74 also removed the unused
optionsDialog
binding, which enabled the removal ofdialogheader
. - Dão Gottwald removed the
dialogheader
binding, after the only consumeroptionsDialog
was removed. - Dão also removed the
timed-textbox
binding, sincetextbox[type=timed]
is unused. - Dão also removed the
tabbrowser-close-tab-button
binding by moving its implementation into the tabbrowser-tab binding. - Ian Moody removed the
toolbarbutton-image
binding and landed a nice cleanup to the tab markup in the process, using a plain<image>
instead. - Ian also removed the
stringbundleset
binding, which wasn’t really doing anything. - I removed the
statusbar
andstatusbarpanel
bindings, moving the accessibility role into XULMap.h. - I removed the xpfe autocomplete bindings which were unused in m-c.