chain.js and Firefox Extension (XUL)

5 views
Skip to first unread message

Lukasz R.

unread,
Mar 26, 2009, 6:50:18 AM3/26/09
to chainjs
Hi!

Does someone try to use it in Firefox extension? I made simple
extension to test chain.js but it didn't work and I didn't get any
error. If I test it with html page everything works fine. Any ideas?
It can be, that this is extension and not chain.js problem. I would
appreciate any answer's. Thanks for your help!

Here are the files:
XUL: http://pastie.org/427539
js: http://pastie.org/427540


raid_ox

unread,
Mar 26, 2009, 9:56:09 AM3/26/09
to chainjs
Hi lukas,

I don't know whether jQuery supports XUL. If it is the case, I am sure
that chain will work there too.

RIzqi

On Mar 26, 11:50 am, "Lukasz R." <lukasz.radziwonow...@gmail.com>
wrote:

raid_ox

unread,
Mar 26, 2009, 10:14:45 AM3/26/09
to chainjs
I am unfortunately not into firefox ext development so I don't know
how to test the code.
but maybe you can try to do some debugging like trying to do:

alert($('#mt-contact .name').html());

Lukasz R.

unread,
Mar 26, 2009, 11:40:54 AM3/26/09
to chainjs
Thanks for your answer :)

I've added "debugging" line and I got "My Name".

I should mention that if I click the button, the default values (My
Name, My Address...) are gone. I think that chain.js is able to find
the "mt-contact" div but isn't able to add new information. Wrong DOM
access? May be this is firefox extension issue (
http://gluei.com/blog/view/using-jquery-inside-your-firefox-extension
)? Official jQuery doesn't support XUL, but I've test it and it works.
Another problem may be that I'm mixing XUL and HTML syntax. I'll
investigate this asap.

Cheers,
Lukasz

Lukasz R.

unread,
Mar 26, 2009, 12:14:27 PM3/26/09
to chainjs
I can see also in DOM Inspector that after click the "mt-contact"
element get new class "chain-element".

Lukasz

On Mar 26, 3:14 pm, raid_ox <raid...@yahoo.de> wrote:

raid_ox

unread,
Mar 26, 2009, 2:31:42 PM3/26/09
to chainjs
ok, I see.

hmm, the new information is added using jquery method $().html(value).
can you please test this too?

$('#mt-contact .name').html("test");
alert($('#mt-contact .name').html());

may be you can take a look at the code here:
http://github.com/raid-ox/chain.js/blob/79d69bfbd381f1589d03518854e077ff62bc9984/src/chain.js
(method for automatic filling is at line 308)

On Mar 26, 5:14 pm, "Lukasz R." <lukasz.radziwonow...@gmail.com>
wrote:

raid_ox

unread,
Mar 26, 2009, 2:39:24 PM3/26/09
to chainjs
hmm, I don't know for sure, but if the problem is that the data isn't
inserted properly so it should be $().html(value) that isn't working
properly.

can you please check $().html(value)?

$('#mt-contact .name').html("test");
alert($('#mt-contact .name').html());


may be its worth looking into the chain.js source code.
http://github.com/raid-ox/chain.js/blob/79d69bfbd381f1589d03518854e077ff62bc9984/src/chain.js
(the relevant code is at line 308++)

On Mar 26, 5:14 pm, "Lukasz R." <lukasz.radziwonow...@gmail.com>
wrote:

Lukasz R.

unread,
Mar 27, 2009, 6:40:00 AM3/27/09
to chainjs
OK, that doesn't work :(

This is problem with jQuery and XUL overlays, you can select XUL
elements using jQuery but you cannot add new elements using append()
or html().
Probably you can modify web page using Firefox extension, jQuery (see
http://gluei.com/blog/view/using-jquery-inside-your-firefox-extension)
and chain.js. I'll check this asap and give you feedback.

Thanks for your time and help :)
Lukasz

On Mar 26, 7:39 pm, raid_ox <raid...@yahoo.de> wrote:
> hmm, I don't know for sure, but if the problem is that the data isn't
> inserted properly so it should be $().html(value) that isn't working
> properly.
>
> can you please check $().html(value)?
>
> $('#mt-contact .name').html("test");
>  alert($('#mt-contact .name').html());
>
> may be its worth looking into the chain.js source code.http://github.com/raid-ox/chain.js/blob/79d69bfbd381f1589d03518854e07...

raid_ox

unread,
Mar 28, 2009, 3:21:52 AM3/28/09
to chainjs
hey may be you can try this one:

http://www.pastie.org/429463
http://www.pastie.org/429698

On Mar 27, 11:40 am, "Lukasz R." <lukasz.radziwonow...@gmail.com>
wrote:
> OK, that doesn't work :(
>
> This is problem with jQuery and XUL overlays, you can select XUL
> elements using jQuery but you cannot add new elements using append()
> or html().
> Probably you can modify web page using Firefox extension, jQuery (seehttp://gluei.com/blog/view/using-jquery-inside-your-firefox-extension)

Lukasz R.

unread,
Mar 30, 2009, 10:51:36 AM3/30/09
to chainjs
I got an error:

Error: this.element.chain("template", "raw") is undefined
Source File: chrome://memticker/content/js/chain.js Line: 1264

I'm looking now for workaround to use pure html (plus jQuey and
chain.js) in Firefox extension.

Lukasz

Lukasz R.

unread,
Mar 31, 2009, 10:24:02 AM3/31/09
to chainjs
Hi,

does it work with chain.js?
$('#myId', doc).items().chain();

I have to use this second parameter in Firefox extension and it works
with item() function (http://wiki.github.com/raid-ox/chain.js/demo-
simple-item-example) but not with items() (http://wiki.github.com/raid-
ox/chain.js/demo-simple-items-example). Any idea?

Cheers,
Lukasz


On Mar 30, 4:51 pm, "Lukasz R." <lukasz.radziwonow...@gmail.com>
wrote:

raid_ox

unread,
Mar 31, 2009, 10:41:13 AM3/31/09
to chainjs
Does it work in normal HTML?

On Mar 31, 4:24 pm, "Lukasz R." <lukasz.radziwonow...@gmail.com>

raid_ox

unread,
Mar 31, 2009, 10:49:42 AM3/31/09
to chainjs
I think you need a [] for items

$('#myId', doc).items([]).chain();

On Mar 31, 4:24 pm, "Lukasz R." <lukasz.radziwonow...@gmail.com>
Message has been deleted

Lukasz R.

unread,
Apr 1, 2009, 5:53:30 AM4/1/09
to chainjs
Yes, this work with normal HTML and I've used [].

I think for now jQuery doesn't fit good in XUL environment.
Thanks for your help.

Lukasz
Reply all
Reply to author
Forward
0 new messages