Closed Bug 93053 Opened 23 years ago Closed 23 years ago

Constructor of XBL gets executed after usage of element

Categories

(Core :: XBL, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: wgrinfeld, Assigned: hyatt)

Details

Attachments

(8 files)

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
Attached file main XUL file
Attached file contents.rdf
Attached file locale/.../xulnote.dtd
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.
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
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
Closed: 23 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: