[Greasemonkey] evaluate and XPCNativeWrapper in 0.6.4

Jeremy Dunck jdunck at gmail.com
Tue Jan 31 09:25:29 EST 2006


On 1/31/06, Anthony Lieuallen <arantius at gmail.com> wrote:
> On 1/31/2006 9:41 AM, Bruce Perry wrote:
> > If I try something like elm.outerHTML, the result is 'undefined'.
>
> Well, outerHTML is an IE only property, of course it's undefined in Moz/FF.

This simulates the get part of it.  Note I haven't done a lot of
testing on it.  You might want to.

Element.prototype.__defineGetter__('outerHTML', function() {
   var ret = [];
   ret.push('<');
   ret.push(this.nodeName.toLowerCase() + ' ');
   for (k in this.attributes) {
     if (this.getAttribute(k)) {
       ret.push(k + '="' + escape(this.getAttribute(k)) + '" ');
     }
   }
   ret.push('>');
   ret.push(this.innerHTML);
   ret.push('</' + this.nodeName.toLowerCase() + '>');
   return ret.join('');
})


More information about the Greasemonkey mailing list