4 function canFind(target
, specimen
)
6 getSelection().empty();
7 document
.body
.innerHTML
= specimen
;
8 document
.execCommand("FindString", false, target
);
9 var result
= getSelection().rangeCount
!= 0;
10 getSelection().empty();
16 function testTestStyle(isExpectedToFind
, style
, outerStyle
)
18 var markup
= "<div style='" + style
+ "'>word</div>";
19 var styleMessage
= "styled with " + style
;
22 markup
= "<div style='" + outerStyle
+ "'>" + markup
+ "</div>";
23 styleMessage
+= " inside an element styled with " + outerStyle
;
26 if (canFind("word", markup
) == isExpectedToFind
)
30 messages
+= " Could not find";
33 messages
+= " a word " + styleMessage
+ ".";
36 function testNonHiddenTextStyle(style
, outerStyle
)
38 testTestStyle(true, style
, outerStyle
);
41 function testHiddenTextStyle(style
, outerStyle
)
43 testTestStyle(false, style
, outerStyle
);
48 if (window
.testRunner
)
49 testRunner
.dumpAsText();
51 testNonHiddenTextStyle("");
53 testHiddenTextStyle("display:none");
54 testHiddenTextStyle("visibility:hidden");
56 testNonHiddenTextStyle("height:0");
58 testHiddenTextStyle("height:0; overflow:hidden");
59 testHiddenTextStyle("height:0; overflow:scroll");
60 testHiddenTextStyle("height:0; overflow:auto");
62 testHiddenTextStyle("width:0; overflow:hidden");
63 testHiddenTextStyle("width:0; overflow:scroll");
64 testHiddenTextStyle("width:0; overflow:auto");
66 testHiddenTextStyle("height:0; overflow-x:hidden");
67 testHiddenTextStyle("height:0; overflow-x:scroll");
68 testHiddenTextStyle("height:0; overflow-x:auto");
70 testHiddenTextStyle("width:0; overflow-x:hidden");
71 testHiddenTextStyle("width:0; overflow-x:scroll");
72 testHiddenTextStyle("width:0; overflow-x:auto");
74 testHiddenTextStyle("height:0; overflow-y:hidden");
75 testHiddenTextStyle("height:0; overflow-y:scroll");
76 testHiddenTextStyle("height:0; overflow-y:auto");
78 testHiddenTextStyle("width:0; overflow-y:hidden");
79 testHiddenTextStyle("width:0; overflow-y:scroll");
80 testHiddenTextStyle("width:0; overflow-y:auto");
82 testHiddenTextStyle("position: relative", "height:0; overflow:hidden");
83 testHiddenTextStyle("position: relative", "height:0; overflow:scroll");
84 testHiddenTextStyle("position: relative", "height:0; overflow:auto");
86 testNonHiddenTextStyle("position: absolute", "height:0; overflow:hidden");
87 testNonHiddenTextStyle("position: absolute", "height:0; overflow:scroll");
88 testNonHiddenTextStyle("position: absolute", "height:0; overflow:auto");
90 testNonHiddenTextStyle("position: fixed", "height:0; overflow:hidden");
91 testNonHiddenTextStyle("position: fixed", "height:0; overflow:scroll");
92 testNonHiddenTextStyle("position: fixed", "height:0; overflow:auto");
95 messages
= "SUCCESS: Found all the strings we expected to, and none we did not expect to.";
97 messages
= "FAILURE:" + messages
;
99 document
.body
.innerHTML
= messages
;
103 <body onload=
"runTests()"></body>