4 https://bugzilla.mozilla.org/show_bug.cgi?id=147777
7 <title>Test for visited link coloring pref Bug
147777</title>
8 <script type=
"application/javascript" src=
"/MochiKit/MochiKit.js"></script>
9 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
11 <style type=
"text/css">
13 :link
{ float: left
; }
15 :visited
{ float: right
; }
20 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=147777">Mozilla Bug
147777</a>
21 <p id=
"display"><a id=
"mylink" href=
"test_visited_pref.html">link to this page
</a></p>
23 <script type=
"application/javascript">
25 /** Test for Bug
147777 **/
27 function reinsert_node(e) {
28 var sib = e.nextSibling;
29 var par = e.parentNode;
31 par.insertBefore(e, sib);
34 netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect");
35 var prefService = Components.classes[
"@mozilla.org/preferences-service;1"].
36 getService(Components.interfaces.nsIPrefService);
37 var dispBranch = prefService.getBranch(
"layout.css.");
41 netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect");
42 return dispBranch.getBoolPref(
"visited_links_enabled");
45 function set_pref(val)
47 netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect");
48 dispBranch.setBoolPref(
"visited_links_enabled", val);
51 is(get_pref(), true,
"pref defaults to true");
53 var link = document.getElementById(
"mylink");
54 var cs = getComputedStyle(link,
"");
55 is(cs.cssFloat,
"right",
":visited selector applies given default preferences");
59 // we don't handle dynamic changes of this pref; it only takes effect
60 // when a new page loads
63 is(cs.cssFloat,
"left",
":visited selector does not apply given false preference");
65 // Set the pref back for the rest of the tests.