views:

1011

answers:

3

When I go to create my status bar overlay, I note that I can include a position attribute. I want to be able to dynamically change this attribute. Near as I can tell, just using JavaScript to find the element and change the position attribute doesn't move the status bar panel around on the status bar.

Any suggestions as to how to accomplish this?

Thanks, Nathan

+1  A: 

You're right, changing the position doesn't seem to have any effect; I assume the XUL engine is only looking at it when it inserts the node into the main document's DOM tree.

Looks like DOM element manipulation stuff will work.

var nodeToMove = ...;
var parent = nodeToMove.parentNode;
parentNode.removeChild(nodeToMove);
parentNode.insertBefore(nodeToMove, someOtherNode);

would take the node from anywhere and stick it before someOtherNode.

Jay Kominek
A: 

Hmm, I could probably craft a solution based on that. But what's the point of having the position attribute if it doesn't work?

Nathan
generally, it's best to comment on an answer by adding a comment rather than adding another answer. The order of answers isn't fixed, as answers are ranked first by votes, so your comment might not be next to the thing you're replying to in the future.
Ben Combee
additionally, I had no idea you'd asked me a question, because you didn't attach it as a comment to my answer, and just happened to stumble back on this.as I said at the time, it looks like the position attribute is only evaluated initially. changes to it aren't picked up.
Jay Kominek
A: 

Hi Nathan,

There's plenty of XUL documentation online and also on mozilla's site
and it's surprisingly well organised sometimes :)
You can have a look here for an example of a XUL toolbar written as an extension to firefox.
It contains information about positioning in the attributes of the tags.
The XUL tutorial here and the XUL reference come in handy when trying to figgure out something like this.

xxxxxxx
The .xul file you linked doesn't even use the position attribute.I had already looked at both the tutorial and the reference you linked. Believe me, I spent a lot of time digging around in the mozilla documentation and Googling before asking this question.
Nathan