User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ When trying to set the wrong kind of element as a table's caption, tHead or tFoot the browser should throw HIERARCHY_REQUEST_ERR. It throws XPC_BAD_CONVERT_JS instead. Reproducible: Always Steps to Reproduce: 1. See testcase
On a related note, Mozilla allows setting tHead to a TBODY or TFOOT element and setting tFoot to a TBODY or THEAD element. It shouldn't, the following should throw an exception, too: tbl = document.createElement("table") tbl.tFoot = document.createElement("thead") Instead, this sets tbl's tHead, tFoot is still null. Weird.
This bug is invalid. You're not passing the right type, so this code is never even making it into the DOM. In C++ you'd get a compile-time error for this code, for example.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID
(In reply to comment #3) > This bug is invalid. You're not passing the right type, so this code is never > even making it into the DOM. In C++ you'd get a compile-time error for this > code, for example. But this isn't C++. :-) Ok, internal these are probably two very different things, but from an API users point of view there isn't much difference between setting table.caption to a HTMLTableCellElement and setting document.body to a HTMLTableCellElement, which generates a HIERARCHY_REQUEST_ERR. Same error, same error message, no? And what about the problem I mentioned in comment 2? Setting table.tHead to a TFOOT element leaves table.tHead untouched and sets table.tFoot instead. That's certainly not desirable behaviour. I certainly don't claim these are devastating bugs that must be fixed ASAP but they are not invalid, IMHO.
> there isn't much difference between setting table.caption to a > HTMLTableCellElement and setting document.body to a HTMLTableCellElement document.body is an HTMLElement. table.caption is an HTMLTableCaptionElement (per the DOM spec). An HTMLTableCellElement is an HTMLElement, but not an HTMLTableCaptionElement. So passing an HTMLTableCellElement to document.body is not a priori unreasonable (per the DOM API) and throws for reasons internal to the DOM. Passing it to table.caption can't even make it into the DOM, like I said -- there's just no way to force that square peg into that round hole. So no, it's not the same error -- in one case you're passing an X to a method that takes Y, while in athe other case the method takes X but you're not passing quite the right X. > And what about the problem I mentioned in comment 2? One bug per problem. Please file a separate bug on that issue and cc me.
Since you say the first problem isn't actually one there is just one problem left here, so I'll just fix the summary.
Severity: minor → trivial
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Summary: Wrong exception thrown when setting table's caption, tHead, tFoot → Setting table's tHead or tFoot to wrong type of table section does weird things
Mutating bugs is generally bad form, for what it's worth...
Created attachment 202423 [details] [diff] [review] Fix
13 years ago
Assignee: general → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → mozilla1.9alpha
Status: NEW → RESOLVED
Last Resolved: 13 years ago → 13 years ago
Resolution: --- → FIXED
You don't want to check the HTML-ness too?
It's already an nsIDOMHTMLTableSectionElement. There's not much more to check in the way of HTML-ness... ;)
You need to log in before you can comment on or make changes to this bug.