Constructor of XBL gets executed after usage of element

RESOLVED INVALID

Status

()

Core
XBL
RESOLVED INVALID
17 years ago
17 years ago

People

(Reporter: Wolfgang Grinfeld, Assigned: David Hyatt)

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(8 attachments)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.2) Gecko/20010628
BuildID:    2001062815

In case an XUL page has elements that are defined in an XBL file, and this XUL
also has <script> in its page, then the script will get executed before the XBL
elements are fully constructed

Reproducible: Always
Steps to Reproduce:
1.create an XUL file and add some JavaScript to that file using the XBL 
2.create XBL for this file + CSS
3.run it

Actual Results:  constructor runs too late 

Expected Results:  constructor should run before using the XBL elements in
JavaScript
(Reporter)

Comment 1

17 years ago
Created attachment 44213 [details]
main XUL file
(Reporter)

Comment 2

17 years ago
Created attachment 44214 [details]
CSS for link to XBL file
(Reporter)

Comment 3

17 years ago
Created attachment 44215 [details]
XBL attached to main XUL file
(Reporter)

Comment 4

17 years ago
Created attachment 44216 [details]
Corrected XBL file attached to XUL
(Reporter)

Comment 5

17 years ago
Created attachment 44217 [details]
contents.rdf
(Reporter)

Comment 6

17 years ago
Created attachment 44218 [details]
xulnote.js: required for running app
(Reporter)

Comment 7

17 years ago
Created attachment 44219 [details]
locale/.../contents.rdf
(Reporter)

Comment 8

17 years ago
Created attachment 44220 [details]
locale/.../xulnote.dtd
(Reporter)

Comment 9

17 years ago
In order to get the bug, one has to bring up a new copy of the browser and the XUL 
page.
Pressing the Reload button seems to give different results.

A workaround to this problem is to use setTimeout('...',0) to run the required
script.

Comment 10

17 years ago
That's because the CSS and XBL loads asynchronously.
You need to use document.loadBindingDocument(url).
Or use an event handler (onload on the document, onbindingattached IIRC -- pls.
correct me if I'm out of date -- on the xbl).  Scripts should not assume a
blocking i/o architecture.  Is this bug invalid?

/be
(Assignee)

Comment 12

17 years ago
This is an invalid bug.  There is no guarantee that the XBL for elements has
been loaded at the time a <script> executes (the document is in a state of
partial construction after all).

If you wait for onload, your bindings will be fine.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.