[Greasemonkey] e4x trick : replacing a subtree of an xml value

Stéphane Payrard stef at stefp.dyndns.org
Tue Apr 11 00:12:39 EDT 2006


What stuck me until recently is how to replace a xml value a
part of a larger xml tree by another xml value b.
I did not see any function doing that in the API but it can be done :

function replace(a, b) {
    a.parent().replace(a.childIndex(), b)
}

Too bad that the firefox implementation does not support a xml value
as a wrapper to a DOM tree. One must copy back and forth from a lement
innerHTML.

--
  cognominal stef


More information about the Greasemonkey mailing list