I’ve written many Jepacks to solve little annoying problems mainly related to urls and tabs.
JetColorTab, the 50 Line code contest’s winner born to solve a need without installing full features extensions.
In these days the Mozilla community (and me) has debated about the future of Jetpack and XUL and many people says “a big number of extensions can be written simply using standard DOM and HTML”
This sentence intrigued me so I’ve tried to rewrite Table2Clipboard (T2C) for Jetpack, T2C makes a simple operation, it copies HTML selection also DOMRange to clipboard preserving the format and many other aspects.
After 30 minutes the porting was completed (excluding the UI not yet rewritten) so heavily DOM oriented extensions can be easily ported to Jetpack but some XUL code remains.
Extensions like NoScript or AdBlockPlus today are very hard (impossible??) to move to Jetpack and hopefully this is not necessary because XUL sits near to us for a long time
Little fixes to T2C required
- Jetpack version 0.6.2 doesn’t allow (or at least I’m not able) to use modules so while waiting for CommonJS comes to Jetpack it is necessary to copy all scripts into the main jetpack file
- HTMLTableElement, HTMLTableCellElement, HTMLTableRowElement are not “visible” so expressions like
if (a instanceof HTMLTableElement) {}don’t work but this isn’t a problem because the code can be written more efficiently
if (a.localName == "TABLE") {} - gContextMenu.target can be replaced by the standard Jetpack context.node, the parameter context is passed for example to beforeShow()
Where XUL is necessary and improvements required
- Jetpack allows to obtain the text or HTML selection using jetpack.selection but it doesn’t expose the focusNode so I used jetpack.tabs.focused.contentWindow.getSelection() (i.e. XUL nsISelection)
- XUL clipboard supports flavors but under Jetpack you can set only one at time, so you can’t add text version plus html version of same content, I think the ‘set’ method should have an ‘add’ mate
- T2C needs to access to CSS using ownerDocument.defaultView.getComputedStyle
- T2C uses the inIDOMUtils, it should be great if this interface become available from Jetpack
Jetpack Table2Clipboard can be downloaded from the Jetpack Gallery



Many users asked to me to add to the extension
Amazon wish list