Closed
Bug 113310
Opened 24 years ago
Closed 24 years ago
Adding/Removing href attribute on <a> node does not update appearance
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Tracking
()
VERIFIED
FIXED
mozilla1.0
People
(Reporter: kinmoz, Assigned: glazou)
References
Details
(Whiteboard: EDITORBASE-, QAHP-top)
Attachments
(2 files, 4 obsolete files)
|
789 bytes,
text/html
|
Details | |
|
2.45 KB,
patch
|
Details | Diff | Splinter Review |
This is an offshoot from bug 108196, which composer may have to work around
until this bug gets fixed ...
It seems that adding or removing the href attribute of an <a> node that is
already in the content tree, does not trigger the layout/style code necessary to
update it's appearance.
That is if an <a> node in the tree doesn't have an href attribute, all of the
content underneath it does not look like a link on screen. Adding the href
attribute should then make it look like a link, and removing it should restore
it back to it's default look.
This case allows you to dynamically add/remove the href attribute of an <a>
node in the content tree.
Comment 2•24 years ago
|
||
This works, just to let you know:
onclick="document.getElementById('atag').href='http://www.mozilla.org'">
Comment 3•24 years ago
|
||
Any chance of this being scheduled for fixing?
Comment 4•24 years ago
|
||
I'll take a guess and suggest that we can probably fix this by indicating that a
change to the href attribute should cause a reframe of the element. I'll try it,
should be easy. If not, then I'll update the bug so you can do the workaround.
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla0.9.8
Comment 5•24 years ago
|
||
Hmm. That did not fix it. I think there is some Style System caching going on
here - over to Style System to investigate.
Assignee: attinasi → pierre
Status: ASSIGNED → NEW
Component: Layout → Style System
Comment 6•24 years ago
|
||
Just FYI: bug 108196 is now a very frequent duplicate ... is the milestone on
this one realistic? Just wanted to let you know.
Comment 7•24 years ago
|
||
Bug 108196, which depends on this, is EDITORBASE, so this needs to be on the
EDITORBASE radar as well.
Whiteboard: EDITORBASE
Comment 8•24 years ago
|
||
Bug 108196 was just marked QAHP-top, so this one has to be too.
Whiteboard: EDITORBASE → EDITORBASE, QAHP-top
Updated•24 years ago
|
Target Milestone: mozilla0.9.8 → ---
| Assignee | ||
Comment 9•24 years ago
|
||
This bug is not specific to anchors ; check second test case.
Comment 10•24 years ago
|
||
Can someone pick this up if Pierre isn't going to get to it soon?
DBaron? Attinasi?
Comment 11•24 years ago
|
||
Daniel: Can you look into this?
Is the problem here that the restyle doesn't happen, or is it just that we're
not clearing the cached link state? Perhaps nsHTMLAnchorElement,
nsHTMLAreaElement, and nsHTMLLinkElement (i.e., the elements that implement
nsILink, at least last I checked) need to override some additional functions to
ensure that they clear the cached link state.
(The other possibility is that we remove this caching and put the info into
RuleProcessorData -- now that the RuleProcessorData is constructed in
WalkRuleProcessors/FileRules (I think), this shouldn't be as much of a
performance hit as it used to be, although it would still be a performance hit
for all dynamic reresolution of style, so I'm inclined to leave the optimization
in.)
Comment on attachment 65617 [details]
second JS test case
Marking this testcase obsolete since it works correctly when the missing ' and
) are added.
Attachment #65617 -
Attachment is obsolete: true
| Assignee | ||
Comment 14•24 years ago
|
||
Right, seen from debug, it seems that we never clear the cached link state.
| Assignee | ||
Comment 16•24 years ago
|
||
David : can you review the patch please ?
| Assignee | ||
Comment 17•24 years ago
|
||
Attachment #70068 -
Attachment is obsolete: true
| Assignee | ||
Comment 18•24 years ago
|
||
nominating nsbeta1.
editor folks : if this gets r= and sr= and I am not available, feel free to
check it in for me!
Keywords: nsbeta1
Comment 19•24 years ago
|
||
Comment on attachment 70076 [details] [diff] [review]
patch v2.0
r=peterv
Attachment #70076 -
Flags: review+
Comment 20•24 years ago
|
||
Note that bug 108196, which this blocks, is "EDITORBASE+, QAHP-top" and nsbeta1+.
Comment 21•24 years ago
|
||
This logic belongs in ::SetAttr(nsINodeInfo *, ...) and ::UnsetAttr() in
nsHTMLAnchorElement, not in the DOM specific attribute methods. If you move the
logic there you can continue to use the macro's for forwarding the DOM methods
and simply override those methods, and that'll do the right thing wrt
case-sensitivity n' all too, w/o ending up calling NormalizeAttrString() twice
for every attribute set. You should also make sure that you only update the link
state if the attribute that's being set is "href" w/o a prefix, to do that check
when you have a nsINodeInfo pointer handy, simply do:
if (aNodeInfo->Equals(nsHTMLAtoms::href, kNameSpaceID_None)) {
...
}
This would be less code and faster, and also more generic so all attribute sets
would be caught (hmm, except the ones that are done directly with
SetHTMLAttribute(), but let's not worry about that for now).
Fix that, and attach a patch and I'll sr...
Updated•24 years ago
|
Target Milestone: --- → mozilla1.0
| Assignee | ||
Comment 23•24 years ago
|
||
Attachment #70076 -
Attachment is obsolete: true
Comment 24•24 years ago
|
||
Hmm, I had a look at the nsGenericHTMLElement code and ::SetAttr(nsINodeInfo *,
...) ends up calling ::SetAttr(PRUint32, ...), so you only need to override the
one that takes the namespace ID, local name, ... arguments, not the one that
takes the nsINodeInfo * argument.
Fix that, and you'll have sr=jst
Comment 25•24 years ago
|
||
Comment on attachment 70500 [details] [diff] [review]
patch v3.0
Ok, talked to glazou about this on #mozilla, and we do need to override both
methods since silly C++ can't cope if we don't. This means that the ::SetAttr()
method that takes an nsINodeInfo* should *only* call the base class' method,
and life would be good.
sr=jst with that little change (i.e. remove everything but the last line in
that SetAttr() method).
Attachment #70500 -
Flags: superreview+
| Assignee | ||
Comment 26•24 years ago
|
||
in answer to irc discussion with jst
Attachment #70500 -
Attachment is obsolete: true
a=roc+moz for 0.9.9
Updated•24 years ago
|
Keywords: mozilla0.9.9+
Shouldn't you fix AREA and LINK as well?
Comment 29•24 years ago
|
||
The same patch should apply more or less directly to those classes
(nsHTMLAreaElement and nsHTMLLinkElement) as well.
Comment 30•24 years ago
|
||
EDITORBASE-, but leaving nsbeta1+ on it. Is the patch going to land soon?
Whiteboard: EDITORBASE, QAHP-top → EDITORBASE-, QAHP-top
| Assignee | ||
Comment 31•24 years ago
|
||
checked in last friday by jfrancis
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 32•24 years ago
|
||
*** Bug 108196 has been marked as a duplicate of this bug. ***
Comment 33•24 years ago
|
||
Petersen, please verify..thanks.
Comment 34•24 years ago
|
||
The fact that the test for bug 108196 works verifies this.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•