Closed
Bug 92071
Opened 23 years ago
Closed 23 years ago
HTMLSpanElement does not inherit from Core Objects
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla0.9.6
People
(Reporter: tfriesen, Assigned: jst)
Details
(Whiteboard: [HAVE FIX])
Attachments
(4 files)
228 bytes,
text/html
|
Details | |
1.99 KB,
patch
|
Details | Diff | Splinter Review | |
4.97 KB,
patch
|
fabian
:
review+
jband_mozilla
:
superreview+
|
Details | Diff | Splinter Review |
11.55 KB,
patch
|
Details | Diff | Splinter Review |
This happens in recent builds (July 23) Example: <div onmouseup="alert(this.test)">DIV Tag</div> <span onmouseup="alert(this.test)">SPAN Tag</span> <script> Element.prototype.test="testing"; //HTMLSpanElement.prototype.test="testing"; </script>
Comment 2•23 years ago
|
||
Comment 3•23 years ago
|
||
seeing this on linux build 2001-07-23-08 as well. Odd, since nsHTMLDivElement and nsHTMLSpanElement inherit from the same things...
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows ME → All
Assignee | ||
Comment 4•23 years ago
|
||
Odd, but accepting...
Status: NEW → ASSIGNED
Hardware: PC → All
Target Milestone: --- → mozilla0.9.4
Assignee | ||
Comment 5•23 years ago
|
||
Moving to mozilla0.9.5
Target Milestone: mozilla0.9.4 → mozilla0.9.5
Comment 6•23 years ago
|
||
/me would like to see the fix if you still have it, it'd be interesting :-)
Assignee | ||
Comment 7•23 years ago
|
||
Assignee | ||
Comment 8•23 years ago
|
||
The problem here is that the span class does not have a leaf interface as its primary interface, because of this the code that sets up the prototype chain on DOM objects ends up not setting the prototype of the span class' prototype so that the chain is linked togethere. Here's a image that shows the difference between div and span, note the lack of a nsIDOMHTMLSpanElement leaf interface: HTMLDivElement HTMLSpanElement | | nsIDOMHTMLDivElement nsIDOMHTMLElement | | nsIDOMHTMLElement nsIDOMElement | | nsIDOMElement nsIDOMNode | | nsIDOMNode nsISupports | nsISupports
Assignee | ||
Updated•23 years ago
|
Whiteboard: [HAVE FIX]
Comment 9•23 years ago
|
||
johnny, is this fix going to effect any other elements from the inheritance point of view.
Assignee | ||
Comment 10•23 years ago
|
||
Sivakiran, yes, this will affect other elements too, the elements should be: HEAD, SUB, SUP, SPAN, BDO, TT, I, B, U, S, STRIKE, BIG, SMALL, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ACRONYM, ABBR, DD, DT, NOFRAMES, NOSCRIPT, ADDRESS, CENTER But mozilla doesn't really support all of those correctly, so I'm not sure how much that list means here.
Comment 11•23 years ago
|
||
i knew it! it's class info's fault! it's always class info's fault! ;-)
Comment 12•23 years ago
|
||
thanks johnny, it helps me in knowing which area i need to concentrate more for testing.
Assignee | ||
Updated•23 years ago
|
Target Milestone: mozilla0.9.5 → mozilla0.9.6
Comment 13•23 years ago
|
||
So, er, why no nsIDOMHTMLSpanElement?
Comment 14•23 years ago
|
||
Now that I think of it... doesn't this happen to all DOM classes whose mProtoChainChainInterface interface is nsIDOMHTMLElement? namely HTMLDelElement, HTMLInsElement, HTMLSpacerElement, HTMLUnknownElement (not sure this one should), HTMLWBRElement. Is there a global solution to fix them all at once?
Comment 15•23 years ago
|
||
> So, er, why no nsIDOMHTMLSpanElement? Because it's not in DOM2 HTML. See http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-58190037 and the table of contents of http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html (which does not list HTMLSpanElement)
Assignee | ||
Comment 16•23 years ago
|
||
Fabian, yes, all those will be fixed.
Assignee | ||
Comment 17•23 years ago
|
||
Assignee | ||
Comment 18•23 years ago
|
||
The attached patch fixes this problem. The patch adds a mHasClassInterface to nsDOMClassInfoData so every class knows if it's proto chain interface is specific to that class or not. For those classes where we don't have a class interface we need to use the name of the proto chain interface for setting up ctor.prototype.__proto__, whereas in the case of a class that *does* have a class interface we use the parent of the proto chain interface when setting up ctor.prototype.__proto__. So in the case where we wrap a span element, our proto chain interface is nsIDOMHTMLElement (since there is no nsIDOMHTMLSpanElement), nsDOMClassInfo::PostCreate() ends up resolving "HTMLSpanElement" (before the patch it incorrectly ended up resolving "HTMLElement" so the HTMLSpanElement ctor was never properly set up). When resolving "HTMLSpanElement" we'll see that the class doesn't have a class interface so we use the proto chain interface nsIDOMHTMLElement directly (in stead of using its parent nsIDOMElement) for figuring out what to set HTMLSpanElement.prototype.__proto__ to. Oh, and storing mScriptableFlags in 31 bits is ok, see nsIXPCScriptable::RESERVED.
Assignee | ||
Comment 19•23 years ago
|
||
Actually the patch doesn't add mHasClassInterface, that was added by mistake in a checkin unrelated to this bug. That's why you don't see the code that specifies what classes don't have a class interface in this patch. Here's the patch that was checked in earlier by mistake: http://bonsai.mozilla.org/cvsview2.cgi?diff_mode=context&whitespace_mode=show&file=nsDOMClassInfo.cpp&root=/cvsroot&subdir=mozilla/dom/src/base&command=DIFF_FRAMESET&rev1=1.72&rev2=1.73
Comment 20•23 years ago
|
||
Comment on attachment 56702 [details] [diff] [review] Better fix. r=fabian after jst fixed iim->GetInfoForIID(sClassInfoData[mID].mProtoChainInterface to be iim->GetInfoForIID(ci_data.mProtoChainInterface
Attachment #56702 -
Flags: review+
Comment 21•23 years ago
|
||
Comment on attachment 56702 [details] [diff] [review] Better fix. r=peterv
Comment 22•23 years ago
|
||
Comment on attachment 56702 [details] [diff] [review] Better fix. sr=jband
Attachment #56702 -
Flags: superreview+
Assignee | ||
Comment 23•23 years ago
|
||
Assignee | ||
Comment 24•23 years ago
|
||
So I had to tweak this a bit before checking in since I found one more minor problem, I found more classes that had class interfaces (in theory, at least) but whose name (due to conflicts with other class names) didn't match the name of the proto chain interface. I also managed to eliminate a nsIID copy, so I did that while I was poking around in this code. With this patch, ComputedCSSStyleDeclaration.prototype.__proto__ === CSSStyleDeclaration.prototype, yay! That didn't work before this latest change. The latest patch is checked in, if someone feels the need to do a post-checkin review of the latest modifications, be my guest. Oh, the latest patch is missing what Fabian pointed out, but the checked in version did contain that fix. Marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 25•23 years ago
|
||
Just wanted to let you know that there is now a warning that dbg_rv is not used. And I'm afraid the compiler is right ;-)
Assignee | ||
Comment 26•23 years ago
|
||
Ah, that is true (in debug builds), I'll take out the unused variable...
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•