Open Bug 268024 Opened 20 years ago Updated 2 years ago

broadcaster not assigning attributes to elements loaded from remote rdf datasource

Categories

(Core :: XUL, defect)

x86
Windows XP
defect

Tracking

()

People

(Reporter: steve, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616

I've defined several command elements to a broadcaster that should
enable/disable a group of buttons. When the buttons are defined in xul with the
commands that observe the broadcaster, they work perfectly. But when a group of
buttons are loaded via template/remote rdf, even when they have the correct
command attribute (confirmed in DOM Inspector), they never take on the disabled
property of the broadcaster. Confirmed in mozilla 1.7 and firefox 1.0 PR

Reproducible: Always
Steps to Reproduce:
1. Here's the xul in question

	<broadcasterset>
		<broadcaster id="selectUser" disabled="true"/>
	</broadcasterset>
	
	<commandset>
		<command id="cmdBtnAdd" oncommand="submit('addUser')"/>
		<command id="cmdBtnEdit" oncommand="submit('editUser')" observes "selectUser"/>
		<command id="cmdBtnDelete" oncommand="submit('deleteUser')" observes
"selectUser"/>
	</commandset>
.....

				<hbox flex="1" pack="center" datasources="server.php?action=edituserButtons"
ref="http://soup.nazi.org/thelist">
					<template>
						<button uri="rdf:*"
							label="rdf:http://soup.nazi.org/rdf#label"
							command="rdf:http://soup.nazi.org/rdf#command"/>
					</template>
				</hbox>

2. And the rdf generated by the datasource above:

<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:zul="http://soup.nazi.org/rdf#">

	<RDF:Seq RDF:about="http://soup.nazi.org/thelist">
		
		<RDF:li RDF:resource="http://soup.nazi.org/row/0">
			<RDF:Description RDF:about="http://soup.nazi.org/row/0">
				<zul:label>Add User</zul:label>
				<zul:command>cmdBtnAdd</zul:command>
			</RDF:Description>
		</RDF:li>

		
		<RDF:li RDF:resource="http://soup.nazi.org/row/1">
			<RDF:Description RDF:about="http://soup.nazi.org/row/1">
				<zul:label>Edit User</zul:label>
				<zul:command>cmdBtnEdit</zul:command>
			</RDF:Description>
		</RDF:li>
		
		<RDF:li RDF:resource="http://soup.nazi.org/row/2">
			<RDF:Description RDF:about="http://soup.nazi.org/row/2">

				<zul:label>Delete User</zul:label>
				<zul:command>cmdBtnDelete</zul:command>
			</RDF:Description>
		</RDF:li>
	</RDF:Seq>
</RDF:RDF>
Actual Results:  
I see all 3 buttons, but Edit User/Delete User are not disabled

Expected Results:  
On load of the xul, Add User should be enabled, Edit User and Delete User
buttons should be disabled.

There is a tree widget that sets the disabled attribute to false on the
broadcaster when a row is selected. As stated before, the broadcaster behaves as
long as everything is defined in the xul. But everything I have tried (passing
in observes, disabled properties in rdf) still generates the same result: the
buttons do not observe the broadcaster, they behave as if none were assigned.
Even modifying the broadcaster after the rdf is loaded still does nothing...the
rdf generated widgets do not reflect the changes.
> 		<command id="cmdBtnAdd" oncommand="submit('addUser')"/>
> 		<command id="cmdBtnEdit" oncommand="submit('editUser')" observes "selectUser"/>
> 		<command id="cmdBtnDelete" oncommand="submit('deleteUser')" observes
> "selectUser"/>

Typo, forgot the = after the observes attributes in the commands. Sorry about that.
This is because observers are hooked up when elements are added to the document,
and not when the observes attribute is changed. The template builder inserts the
generated nodes first and then handles the attribute replacement. As a result,
the observer is trying to listen to an element with id
'rdf:http://soup.nazi.org/rdf#command'

The fix for this is to make xul realize that these attributes change.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Note that nsXULElement::UnsetAttr deals with "observes".. So SetAttr() is what
needs fixing.
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.widgets
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.