Closed
Bug 120607
Opened 23 years ago
Closed 23 years ago
nsGenericHTMLElement::HasAttribute() sometimes returns false when attribute exists
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla0.9.8
People
(Reporter: cmanske, Assigned: cmanske)
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
570 bytes,
text/html
|
Details | |
723 bytes,
patch
|
bzbarsky
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
Using "element.hasAttribute()" on an element in a document being edited is always returning false when I know it exists. In JS code, foo.getAttribute() returns a value and foo.attributes.getNamedItem() correctly returns an attribute node. I'll attach a test file.
Assignee | ||
Comment 1•23 years ago
|
||
This test succeeds in NS 6.2.1
Assignee | ||
Comment 2•23 years ago
|
||
This problem would seem rather critical!
Severity: normal → critical
Assignee | ||
Comment 3•23 years ago
|
||
I did some debugging and find that some attributes do succeed: E.g., if I have an "img" with "width", "height", and "alt" set, the "width" and "height" are found by FindHTMLAttribute(), but "src" and "alt" are not. The search for attributes starts with "mFirst". Could this be wrong? cc'ing Hewitt, since he wrote nsHTMLMappedAttributes::GetAttribute().
Summary: nsGenericHTMLElement::HasAttribute() always returns false → nsGenericHTMLElement::HasAttribute() sometimes returns false when attribute exists
Assignee | ||
Comment 4•23 years ago
|
||
Note that the test file seems to succeed in NS 6.2.1 because "HasAttribute()" wasn't implemented! So that fact is irrelevant. Since Hewitt implemented this stuff recently (12/10/01), reassigning to him.
Assignee: jst → hewitt
Comment 5•23 years ago
|
||
Not all attributes are mapped attributes. Mapped ones worked fine with the existing code, non-mapped ones broke.
Comment 6•23 years ago
|
||
reviews?
Assignee | ||
Comment 7•23 years ago
|
||
I just figured out the same thing!
Assignee | ||
Comment 8•23 years ago
|
||
Comment on attachment 65466 [details] [diff] [review] Another version, somewhat simpler darn, attached wrong diff! line should be: + if (mMapped && mMapped->HasAttribute(aAttrName)) of course! (no ";")
Comment 9•23 years ago
|
||
That works too. :) jst, is there a function that takes and nsIAtom and quickly says "mapped" or "not mapped" so that we can avoid doing FindHTMLAttribute for mapped attributes that are note set?
Comment 10•23 years ago
|
||
Comment on attachment 65466 [details] [diff] [review] Another version, somewhat simpler Whether or not an attribute is mapped or not depends on the element, so there is no such method AFAIK. sr=jst
Attachment #65466 -
Flags: superreview+
Comment 11•23 years ago
|
||
Comment on attachment 65466 [details] [diff] [review] Another version, somewhat simpler Ok, then. r=bzbarsky
Attachment #65466 -
Flags: review+
Updated•23 years ago
|
Attachment #65463 -
Attachment is obsolete: true
Assignee | ||
Comment 12•23 years ago
|
||
Thanks for reviews. Should we check this in for 0.9.8? (I'll ask drivers for that)
Assignee: hewitt → cmanske
Target Milestone: --- → mozilla0.9.8
Comment 13•23 years ago
|
||
this testcases passed in 6.2.1 RTM, it is a regression from Gecko/20011128
Keywords: regression
Comment 15•23 years ago
|
||
I saw a checkin comment referencing this bug: "01/18/2002 12:08cmanske%netscape.com mozilla/ content/ html/ style/ src/ nsHTMLAttributes.cpp 3.66 2/2 Fixed hasAttribute for non-mapped attributes, b=120607, r=bzbarsky@mit.edu, sr=jst, a=blizzard/drivers" Is it resolved? If so, can you mark it Fixed to pull it from the "0.9.8 outstanding" list? Thanks.
Assignee | ||
Comment 16•23 years ago
|
||
checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
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
•