[Greasemonkey] onpropertychange emulation
Gareth Andrew
freega at freegarethandrew.org
Thu Oct 13 19:30:18 EDT 2005
Matt,
What you are seeing is expected behaviour, XPCNativeWrappers don't have
a watch function. In the second example textarea is an
XPCNativeWrapper, since it is derived from document which is a deep
XPCNativeWrapper. In the first example you are not accessing an
XPCNativeWrapper, as unsafeWindow is not an XPCNativeWrapper and
therefore neither is document or any of its child elements.
Gareth.
On Thu, 2005-10-13 at 22:46 +0930, Matt Labrum wrote:
> Ok Ive found something mega odd in my wysiwyg editor I replace the focus of
> the old textarea so i can copy text etc well i decided to replace it with
> watch heres what ive found so far with it and xpaths.
>
> the function textarea.watch exists here.
> textarea = unsafeWindow.document.evaluate('//textarea[@name="message"]',
> unsafeWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
> null).singleNodeValue;
>
> yet in this one the textarea.watch function dosnt exist it returns that the
> function dosnt exist.
> textarea = document.evaluate('//textarea[@name="message"]',document, null,
> XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
>
>
> which seems odd :-/ , Im going to create a test case ina sec to make sure.
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051011
> Firefox/1.6a1
>
>
> On 10/13/05, Aaron Boodman <zboogs at gmail.com> wrote:
> >
> > You could also use watch I think. If you have a ref to the form and form
> > field:
> >
> > myFormField.watch("value", function() {
> > myForm.submit();
> > });
> >
> > - a
> >
> > On 10/13/05, Matt Labrum <darktempler at gmail.com> wrote:
> > > :-/ well a javascript function has to fill that box because its a hidden
> > > field so maybe you could do something like...
> > >
> > > //move the function into a varible we know of
> > > var oldfunc = unsafeWindow.functionwhichchangesthat;
> > >
> > > //overwrite that function so we can call our stuff after it runs.
> > > unsafeWindow.functionwhichchangesthat = function (){
> > > oldfunc.apply(window,arguments);
> > >
> > > // call the onpropertychange function now! , or check to see if the data
> > is
> > > changed etc.
> > >
> > > }
> > >
> > >
> > > so you can call your code after the function runs and stuff....
> > >
> > > On 10/13/05, Ilia K. <mail4ilia at gmail.com> wrote:
> > > >
> > > > Hi, All!
> > > >
> > > > I'm trying to make one IE-oriented site work in Firefox with the help
> > > > of greasemonkey and its amazing community (Thank you Lenny Domnitser
> > > > and David Kaspar!)
> > > > Now I'm need to workaround such a code:
> > > >
> > > > <input type=hidden name='page_pg_fnd'
> > > > onpropertychange="document.all('oFrm').submit()" value='1'>
> > > >
> > > > This input field is changed from several javascript functions, but
> > > > Gecko has no support for "onpropertychange" event and such a changes
> > > > don't trigger form submit (yeah, quite a poor design).
> > > > Has anybody any ideas, how to emulate the above thing in Firefox (
> > 1.5beta1)
> > > > ?
> > > >
> > > > Thanks.
> > > > _______________________________________________
> > > > Greasemonkey mailing list
> > > > Greasemonkey at mozdev.org
> > > > http://mozdev.org/mailman/listinfo/greasemonkey
> > > >
> > > _______________________________________________
> > > Greasemonkey mailing list
> > > Greasemonkey at mozdev.org
> > > http://mozdev.org/mailman/listinfo/greasemonkey
> > >
> > _______________________________________________
> > Greasemonkey mailing list
> > Greasemonkey at mozdev.org
> > http://mozdev.org/mailman/listinfo/greasemonkey
> >
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
More information about the Greasemonkey
mailing list