[Project_owners] prefwindow/prefpane randomness

Paul Tomlin paul at paultomlin.com
Mon Mar 13 11:59:56 EST 2006


Neil wrote:
> Philip Chee wrote:
> 
>> On Sun, 12 Mar 2006 21:03:11 +0000, Paul Tomlin wrote:
>>
>>> Given that I can't put a <script /> between the <prefwindow /> and 
>>> the first <prefpane />, are there any tricks that might be out there 
>>> to insert JS into the <prefwindow />?
>>>   
>> Will putting <script></script> at the end after the last </prefpane> 
>> but before the </prefwindow> work?

I never tried that, just didn't occur to me. Too entrenched in the 
"scripts are in the head" routine I guess.

> Out of interest, why does the position of the <script> (apart from the 
> obvious point that within a given xul file scripts compile in the order 
> in which they are encountered) make any difference?

There's a bug #296418 which means you can't place any elements between 
the opening <prefwindow> and the first <prefpane>. I don't know how the 
context switches if <script> elements are placed in children of root 
element of a XUL file, though it appears to work for me by using

<prefwindow>
	<prefpane onpaneload="onPaneLoadFunction();">
		<script src="[definition of onPaneLoadFunction]" />
	</prefpane>
</prefwindow>

Rather than the possibly more traditional
window.addEventListener('load',...)
with a page wide script.


More information about the Project_owners mailing list