зеркало из https://github.com/mozilla/gecko-dev.git
Bug 549797 - Removing href attribute from html:a, html:link, and svg:a doesn't remove link styling
r=bz
This commit is contained in:
Родитель
f438a358c3
Коммит
d1cb40d001
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for bug 549797 - Removing href attribute doesn't remove link styling</title>
|
||||
<style type="text/css">
|
||||
a, link {
|
||||
display:block;
|
||||
}
|
||||
link::before {
|
||||
content:"Test link";
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<a>Test anchor</a>
|
||||
<link/>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for bug 549797 - Removing href attribute doesn't remove link styling</title>
|
||||
<style type="text/css">
|
||||
link {
|
||||
display:block;
|
||||
}
|
||||
link::before {
|
||||
content:"Test link";
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="run_test();">
|
||||
<script type="text/javascript">
|
||||
function run_test()
|
||||
{
|
||||
// Remove the href attributes of the links so they should be restyled as
|
||||
// non-links.
|
||||
document.getElementById("link1").removeAttribute("href");
|
||||
document.getElementById("link2").removeAttribute("href");
|
||||
}
|
||||
</script>
|
||||
<p>
|
||||
<a id="link1" href="http://example.com/1">Test anchor</a>
|
||||
<link id="link2" href="http://example.com/1"/>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -7,3 +7,4 @@
|
|||
== 468263-2.html 468263-2-ref.html
|
||||
== 468263-2.html 468263-2-alternate-ref.html
|
||||
== 484200-1.html 484200-1-ref.html
|
||||
== href-attr-removal-restyles.html href-attr-removal-restyles-ref.html
|
||||
|
|
|
@ -468,16 +468,24 @@ nsresult
|
|||
nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::accesskey &&
|
||||
kNameSpaceID_None == aNameSpaceID) {
|
||||
RegUnRegAccessKey(PR_FALSE);
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
|
||||
aNotify);
|
||||
|
||||
// The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
|
||||
// is important here! The attribute is not unset until UnsetAttr returns, and
|
||||
// we will need the updated attribute value because notifying the document
|
||||
// that content states have changed will call IntrinsicState, which will try
|
||||
// to get updated information about the visitedness from Link.
|
||||
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
|
@ -267,16 +267,24 @@ nsresult
|
|||
nsHTMLAreaElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::accesskey &&
|
||||
aNameSpaceID == kNameSpaceID_None) {
|
||||
RegUnRegAccessKey(PR_FALSE);
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
|
||||
aNotify);
|
||||
|
||||
// The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
|
||||
// is important here! The attribute is not unset until UnsetAttr returns, and
|
||||
// we will need the updated attribute value because notifying the document
|
||||
// that content states have changed will call IntrinsicState, which will try
|
||||
// to get updated information about the visitedness from Link.
|
||||
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define IMPL_URI_PART(_part) \
|
||||
|
|
|
@ -322,10 +322,6 @@ nsresult
|
|||
nsHTMLLinkElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
|
||||
aNotify);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -337,6 +333,15 @@ nsHTMLLinkElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
|||
aAttribute == nsGkAtoms::type));
|
||||
}
|
||||
|
||||
// The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
|
||||
// is important here! The attribute is not unset until UnsetAttr returns, and
|
||||
// we will need the updated attribute value because notifying the document
|
||||
// that content states have changed will call IntrinsicState, which will try
|
||||
// to get updated information about the visitedness from Link.
|
||||
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -286,11 +286,18 @@ nsresult
|
|||
nsSVGAElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr,
|
||||
PRBool aNotify)
|
||||
{
|
||||
nsresult rv = nsSVGAElementBase::UnsetAttr(aNameSpaceID, aAttr, aNotify);
|
||||
|
||||
// The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
|
||||
// is important here! The attribute is not unset until UnsetAttr returns, and
|
||||
// we will need the updated attribute value because notifying the document
|
||||
// that content states have changed will call IntrinsicState, which will try
|
||||
// to get updated information about the visitedness from Link.
|
||||
if (aAttr == nsGkAtoms::href && aNameSpaceID == kNameSpaceID_XLink) {
|
||||
Link::ResetLinkState(!!aNotify);
|
||||
}
|
||||
|
||||
return nsSVGAElementBase::UnsetAttr(aNameSpaceID, aAttr, aNotify);
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Test for bug 549797 - Removing href attribute doesn't remove link styling</title>
|
||||
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
a {
|
||||
fill: blue;
|
||||
}
|
||||
a:link {
|
||||
fill: red;
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
|
||||
<a>
|
||||
<text x="10" y="100">Test anchor</text>
|
||||
</a>
|
||||
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 382 B |
|
@ -0,0 +1,22 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
onload="document.getElementById('link').removeAttribute('xlink:href');">
|
||||
|
||||
<title>Test for bug 549797 - Removing href attribute doesn't remove link styling</title>
|
||||
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
a {
|
||||
fill: blue;
|
||||
}
|
||||
a:link {
|
||||
fill: red;
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
|
||||
<a id="link" xlink:href="http://example.com/1">
|
||||
<text x="10" y="100">Test anchor</text>
|
||||
</a>
|
||||
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 504 B |
|
@ -154,3 +154,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != text-language-01.xhtml text-language-01
|
|||
== svg-effects-area-unzoomed.xhtml svg-effects-area-unzoomed-ref.xhtml
|
||||
fails == svg-effects-area-zoomed-in.xhtml svg-effects-area-zoomed-in-ref.xhtml # Bug 541270
|
||||
fails == svg-effects-area-zoomed-out.xhtml svg-effects-area-zoomed-out-ref.xhtml # Bug 541270
|
||||
== href-attr-removal-restyles.svg href-attr-removal-restyles-ref.svg
|
||||
|
|
Загрузка…
Ссылка в новой задаче