Bug Tracker

Ticket #3150: temp.html

File temp.html, 1.5 KB (added by aakoch, 14 years ago)

File to test attribute selection

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4<html>
5<head>
6<title>jQuery Test</title>
7</head>
8<script src="jquery-1.2.6.min.js" type="text/javascript"></script>
9
10<script>
11
12var output = [];
13function testSelector(selector) {
14    try {
15        if ($(selector).size() > 0)
16            output.push("link found using selector \"" + selector + "\"");
17        else
18            output.push("link NOT found using selector \"" + selector + "\"");
19    }
20    catch (e) {
21        output.push("exception caught using selector \"" + selector + "\" - " + e);
22    }
23}
24
25$(document).ready(function(){
26
27    testSelector("a");
28    testSelector("a[name]");
29    testSelector("a[name=foo]");
30    testSelector("a[name='foo']");
31    testSelector("a[name*=foo]");
32    testSelector("a[name*='foo']");
33
34    testSelector("a");
35    testSelector("a[madeupattr]");
36    testSelector("a[madeupattr=wally()]");
37    testSelector("a[madeupattr='wally()']");
38    testSelector("a[madeupattr*=wally()]");
39    testSelector("a[madeupattr*='wally()']");
40   
41    testSelector("a[onclick]");
42    testSelector("a[onclick=bar()]");
43    testSelector("a[onclick='bar()']");
44    testSelector("a[onclick^=bar]");
45    testSelector("a[onclick*=bar]");
46    testSelector("a[onclick*='bar']");
47
48    $("#output").html(output.join("\n<br\>"));
49   
50});
51 
52</script>
53
54<body>
55
56<a name="foo" onclick="bar()" madeupattr="wally()" href="no.html">foobar link</a>
57
58<div id="output"></div>
59
60</body>
61</html>
62