Bookmarklets updated to comply with DOM 2 rule
Thursday, November 2nd, 2006DOM 2 does not allow nodes to be moved between documents -- in fact, it requires that implementations throw an error when code tries to do so. But for years, Gecko has not enforced this rule.
It's a bit embarrassing that Internet Explorer gets this right and we get it wrong. Someone might think Gecko is trying to embrace and extend the DOM.
Soon, Gecko will start enforcing the rule on trunk. But bringing Gecko in line with this aspect of the DOM spec risks breaking Gecko-specific code, such as code in extensions and bookmarklets written for Firefox. For example, my Search Keys extension used to create some nodes in the chrome document, and some in the foreground tab, before putting them in the tab that that just loaded. Search Keys 0.8 creates all elements in the correct document.
I also updated the following bookmarklets to create nodes in the correct document and/or use importNode when copying nodes between documents:
- Validation bookmarklets: list alts
- Web development bookmarklets: partial source, view style sheets, view scripts
- Text and data bookmarklets: view selection
- Bookmarklets for testing browsers: clone document
These bookmarklets previously only worked in browsers that violated the DOM spec by allowing nodes to be moved between documents without a call to importNode or adoptNode. Maybe some of them work in IE now.
If you use those bookmarklets, you should grab the new versions so they won't break when you update to next week's trunk build or to Firefox 3.