Last Comment Bug 83830 - Binding TD cells (with XBL) doesn't work, at all
: Binding TD cells (with XBL) doesn't work, at all
[Hixie-P4] [xbl1.0]
: helpwanted
Product: Core
Classification: Components
Component: XBL (show other bugs)
: Trunk
: All All
-- normal with 7 votes (vote)
: ---
Assigned To: xbl
: Hixie (not reading bugmail)
: Andrew Overholt [:overholt]
: 107974 291841 363608 (view as bug list)
Depends on: 243159
  Show dependency treegraph
Reported: 2001-06-02 12:29 PDT by Jason Davis
Modified: 2010-04-22 12:26 PDT (History)
12 users (show)
bzbarsky: in‑testsuite?
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Shows a workaround by using bindings on table element itself (1.21 KB, application/octet-stream)
2006-05-03 11:54 PDT, VK
no flags Details
Simple HTML+XBL testcase (10.00 KB, application/x-tar)
2006-05-29 15:11 PDT, Justin Dolske [:Dolske]
no flags Details
Simple HTML+XBL testcase v2 (30.00 KB, application/x-tar)
2007-01-04 16:41 PST, Justin Dolske [:Dolske]
no flags Details

Description User image Jason Davis 2001-06-02 12:29:15 PDT
As the summary says, if you try binding a TD cell using XBL, nothing appears to
happpen. (I tested binding events, I'm sure about anonymous content though).

Look at the link associated with this bug, I have a page with a table, and a
link beneath it. Clicking on the link, an alert pops up saying "#text". Click on
the table cell, nothing happens. But they both have the exact same binding.

I've tested this on all the Mozilla builds I have, including Mozilla 0.81 and
Mozilla 0.9 build 2001050515.
Comment 1 User image Boris Zbarsky [:bz] (still a bit busy) 2001-06-02 20:56:31 PDT
Jason, could you also test a recent nightly?
Comment 2 User image Jason Davis 2001-06-03 09:49:10 PDT
As I am cursed with a  dial up connection, I had one of my friends with 
broadband access download the nightly, with the user agent:
Mozilla/5.0 (Windows; U; Win95; en-US; rv:0.9+) Gecko/20010602

The same thing happens, the binding on the link works flawlessly, 
alerting "#text", but when he clicks on the TD cell, absolutely nothing happens.
Comment 3 User image Jason Davis 2001-06-08 19:09:55 PDT
Testing the latest build of Mozilla 0.91, still nothing.
I also decided to test the ability of other table elements to be bound, and as 
it turns out, not only TD fails, but so does TH, TR, TBODY, TFOOT, THEAD, as 
well as TABLE.
Comment 4 User image Jason Johnston 2001-11-01 08:45:16 PST
*** Bug 107974 has been marked as a duplicate of this bug. ***
Comment 5 User image deneen 2001-11-01 09:07:06 PST
still happens in 0.9.5 as well.

Comment 6 User image 2003-06-20 04:27:43 PDT
still happening ... 

Seems like this is not directly related to the TD html tag but to something more
deeply in the system? 

I tried the following

<html xmlns="">
		<title>table XBL</title>
		<style type="text/css">
			.xbl {
				-moz-binding: url('table.xbl#test'); 
			block { display: block }
			row { display: block; }
			cell { display: table-cell; }
				<cell class="xbl">cell data</cell>
				<cell class="xbl">cell data</cell>
				<cell class="xbl">cell data</cell>
				<cell class="xbl">cell data</cell>

up to this point the xbl gets bound to the CELL elements.
When I change the ROW styling to display:table-row then the CELLs no longer get
the XBL attached

this is with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030615
Comment 7 User image Fred Le Guern 2004-11-19 09:43:06 PST
Just dropping in, I spotted the same problem on my system
[Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.5) Gecko/20041108
yet I can bind a TABLE (but not a TD or a TR).

Here's a test page :
Comment 8 User image VK 2006-05-02 08:03:01 PDT
Confirmed for Firefox

I say this bug is MAJOR. It obviously renders XBL useless for 50% or more of Web projects (all table layouts and most importantly all real data tables).

Inline test sample:

<title>Hello world!</title>
<style type="text/css">
p {
 background-color: yellow;
 -moz-binding: url(content.xml#default);

td {
 background-color: yellow;
 -moz-binding: url(content.xml#default);
<p>Default content</p>

// content.xml
<?xml version="1.0"?>
<bindings xmlns=""
  <binding id="default">
    <content><html:b>Hello world! </html:b><children/></content>

Actual results: the very same behavior attached Ok to <p> but silently ignored by <td>.

P.S. Drove me unsane before I searched for this bug.
Comment 9 User image VK 2006-05-02 08:18:33 PDT
After further investigation: 

class assignment for TD is ignored too. 
.foobar {
 background-color: yellow;
 -moz-binding: url(content.xml#default);
<td class="foobar">...</td>

In the above case binding is still silently ignored.

The only workaround is to add an inline block to cell:

span {
 -moz-binding: url(content.xml#default);
<td><span>Now it works</span></td>

I may appear very wrong, but it looks very much as an intentional block, not a bug. Someone was thinking of 1000...10000 cells tables, memory usage etc. and just took the regular "Solomon decision" here: no feature - no problems.
Comment 10 User image VK 2006-05-03 11:54:40 PDT
Created attachment 220684 [details]
Shows a workaround by using bindings on table element itself

From all <table> elements one currently can attach bindings only to the table object itself. Something is better than nothing and allows to overpass the bug by coding in <constructor> section. Evidently semi-defeats the purpose of bindings, but see above about something and nothing.
Comment 11 User image BG 2006-05-18 07:31:00 PDT
I would also consider this a MAJOR bug, particularly in light of the recent emphasis on AJAX and dynamically rendered HTML.  
Comment 12 User image Weston Ruter 2006-05-24 10:51:31 PDT
I am attempting to create XBL bindings to implement the Web Forms 2.0 Repetition Model. I have been using one of the examples in the spec to test my bindings. The example uses table rows as the repetition blocks, and so I tried to apply my bindings to these rows but there was no effect. When I tried using DIVs instead, everything worked as expected.

I too agree that this is a major bug.
Comment 13 User image Boris Zbarsky [:bz] (still a bit busy) 2006-05-27 08:51:15 PDT
We probably need to either nuke TableProcessChild or make it do XBL resolution on the kid.
Comment 14 User image Bernd 2006-05-27 11:25:39 PDT
hmmm, TableProcessChild the unloved stepchild.... bug 243159 has a lengthy entry why we have this function and it waits for you (Boris) to decide how to proceed.
Comment 15 User image Boris Zbarsky [:bz] (still a bit busy) 2006-05-27 11:44:58 PDT
Yeah.  I need to find time to think about it; it'll be after I get home on Monday.  ;)
Comment 16 User image Justin Dolske [:Dolske] 2006-05-29 12:44:23 PDT
I ran into this problem when working on some code, and managed to find a workaround...

Use the CSS -moz-binding as normal, then "activate" it by detaching and reattaching the bound node after the page has loaded.

For example:

var TD = (some TD node with a binding on it);
var parent = TD.parentNode;
parent.replaceChild(TD, TD);

IIRC, I first stumbled across this by calling removeChild() & appendChild(), but a single replaceChild() is convenient and efficient. This seems to work fine in FF1.5. The main downside for me is that you don't get to see the XBL's effect until after the page loads and the onload event triggers the "activation" code.

Unfortunately, the big bummer is that this trick doesn't seem to work in Bon Echo Alpha 3. I'm not sure if there's another workaround, or if something changed such that now it really is impossible to bind XBL to table elements... If the root problem can't be fixed, I wonder if reenabling this workaround might be possible?

Would it be helpful if I tested with past branch builds to figure out when this stopped working?
Comment 17 User image Boris Zbarsky [:bz] (still a bit busy) 2006-05-29 12:54:37 PDT
Yes, that would be very useful.  Behavior here should really not have changed on branch...
Comment 18 User image Justin Dolske [:Dolske] 2006-05-29 15:11:43 PDT
Created attachment 223729 [details]
Simple HTML+XBL testcase

Ok... My workaround is OK in the 2006-05-16-04 linux build, but fails in the 2006-05-16-12 build. I'm attaching the testcase I used.

I also made a surprising discovery... Sometime between alpha1 and alpha2, the CSS binding started working as expected (no workaround needed)! It continued working until whatever happened on May 16th broke things again, completely.
Comment 20 User image Boris Zbarsky [:bz] (still a bit busy) 2006-05-29 19:55:35 PDT
Justin, please file a separate bug for the regression and cc me?  That should block 1.8, imo.
Comment 21 User image Justin Dolske [:Dolske] 2006-05-30 12:36:25 PDT
Bug 339719 filed for the regression.
Comment 22 User image Boris Zbarsky [:bz] (still a bit busy) 2006-06-01 20:34:51 PDT
Frankly, we've had this for about forever.  We might as well fix things the right way by rearchitecting per my proposal in bug 243159 instead of duplicating yet more code between the frame construction codepaths.
Comment 23 User image Bernd 2006-12-12 11:20:06 PST
*** Bug 363608 has been marked as a duplicate of this bug. ***
Comment 24 User image Boris Zbarsky [:bz] (still a bit busy) 2007-01-03 07:11:57 PST
Fixed by checkin for bug 243159.
Comment 25 User image Justin Dolske [:Dolske] 2007-01-04 16:41:23 PST
Created attachment 250530 [details]
Simple HTML+XBL testcase v2

Woohoo! Glad to see this fixed.

I've attached an updated testcase, which confirms that this is now working.
Comment 26 User image aaronr 2010-04-22 12:26:09 PDT
*** Bug 291841 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.