зеркало из https://github.com/mozilla/gecko-dev.git
Bug 550661 - Adding href attribute doesn't add link styling
r=bz --HG-- rename : content/html/content/reftests/href-attr-removal-restyles-ref.html => content/html/content/reftests/href-attr-change-restyles-ref.html rename : content/html/content/reftests/href-attr-removal-restyles.html => content/html/content/reftests/href-attr-change-restyles.html rename : layout/reftests/svg/href-attr-removal-restyles-ref.svg => layout/reftests/svg/href-attr-change-restyles-ref.svg rename : layout/reftests/svg/href-attr-removal-restyles.svg => layout/reftests/svg/href-attr-change-restyles.svg
This commit is contained in:
Родитель
e8cd5c9ea7
Коммит
ef09b590f8
|
@ -469,17 +469,11 @@ Link::ResetLinkState(bool aNotify)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are not a link, revert to the default state and do no more work.
|
|
||||||
if (mLinkState == eLinkState_NotLink) {
|
|
||||||
mLinkState = defaultState;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIContent *content = Content();
|
nsIContent *content = Content();
|
||||||
|
|
||||||
// Tell the document to forget about this link.
|
// Tell the document to forget about this link if we were a link before.
|
||||||
nsIDocument *doc = content->GetCurrentDoc();
|
nsIDocument *doc = content->GetCurrentDoc();
|
||||||
if (doc) {
|
if (doc && mLinkState != eLinkState_NotLink) {
|
||||||
doc->ForgetLink(this);
|
doc->ForgetLink(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<!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;
|
||||||
|
}
|
||||||
|
#link2::before {
|
||||||
|
content:"Test link 1";
|
||||||
|
}
|
||||||
|
#link4::before {
|
||||||
|
content:"Test link 2";
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
<a>Test anchor 1</a>
|
||||||
|
<link id="link2"/>
|
||||||
|
<a href="http://example.com/1">Test anchor 2</a>
|
||||||
|
<link id="link4" href="http://example.com/1"/>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -6,8 +6,11 @@
|
||||||
link {
|
link {
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
link::before {
|
#link2::before {
|
||||||
content:"Test link";
|
content:"Test link 1";
|
||||||
|
}
|
||||||
|
#link4::before {
|
||||||
|
content:"Test link 2";
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -19,11 +22,17 @@ function run_test()
|
||||||
// non-links.
|
// non-links.
|
||||||
document.getElementById("link1").removeAttribute("href");
|
document.getElementById("link1").removeAttribute("href");
|
||||||
document.getElementById("link2").removeAttribute("href");
|
document.getElementById("link2").removeAttribute("href");
|
||||||
|
|
||||||
|
// Add the href attribute to the links so they should be restyled as links.
|
||||||
|
document.getElementById("link3").href = "http://example.com/1";
|
||||||
|
document.getElementById("link4").href = "http://example.com/1";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<p>
|
<p>
|
||||||
<a id="link1" href="http://example.com/1">Test anchor</a>
|
<a id="link1" href="http://example.com/1">Test anchor 1</a>
|
||||||
<link id="link2" href="http://example.com/1"/>
|
<link id="link2" href="http://example.com/1"/>
|
||||||
|
<a id="link3">Test anchor 2</a>
|
||||||
|
<link id="link4"/>
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,20 +0,0 @@
|
||||||
<!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>
|
|
|
@ -15,7 +15,11 @@ a:link {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<a>
|
<a>
|
||||||
<text x="10" y="100">Test anchor</text>
|
<text x="10" y="100">Test anchor 1</text>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a xlink:href="http://example.com/1">
|
||||||
|
<text x="10" y="100">Test anchor 2</text>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</svg>
|
</svg>
|
До Ширина: | Высота: | Размер: 382 B После Ширина: | Высота: | Размер: 482 B |
|
@ -0,0 +1,27 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
onload="document.getElementById('link1').removeAttribute('xlink:href');
|
||||||
|
document.getElementById('link2').setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'http://example.com/1');">
|
||||||
|
|
||||||
|
<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="link1" xlink:href="http://example.com/1">
|
||||||
|
<text x="10" y="100">Test anchor 1</text>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a id="link2">
|
||||||
|
<text x="10" y="100">Test anchor 2</text>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</svg>
|
После Ширина: | Высота: | Размер: 710 B |
|
@ -1,22 +0,0 @@
|
||||||
<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 |
Загрузка…
Ссылка в новой задаче