summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/uievents/legacy-domevents-tests/submissions/Microsoft/hasFeature.feature.string.html
blob: e96c39c8556e3fae603a9f25e9370fda6fad2eac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE HTML>
<html>
    <head>
        <title id='desc'> DOMImplementation.hasFeature() and Extended Feature String </title>
        <script type="text/javascript">
            var PassTest = function()
            {
                document.getElementById("testresult").firstChild.data = "PASS";
            }

            var FailTest = function()
            {
                document.getElementById("testresult").firstChild.data = "FAIL";
            }

            var szFeatures = ["Event", "UIEvent","FocusEvent","MouseEvent","WheelEvent","TextEvent",
                              "KeyboardEvent","CompositionEvent","MutationEvent","CustomEvent"];

            var ExpectResult = [];
            var ActualResult = [];
            var supported = false;

            window.onload = function()
            {
                try
                {
                    supported = document.implementation.hasFeature("Events", "3.0");

                    for (var i=0; i<szFeatures.length; i++)
                    {
                        var szFeature = szFeatures[i];

                        supported = document.implementation.hasFeature(szFeature, "3.0") && supported;
                        supported = document.implementation.hasFeature(szFeature, "") && supported;
                        if (!supported)
                        {
                            break;
                        }
                    }

                    for (var i=0; i<szFeatures.length; i++)
                    {
                        var szFeature = "Events." + szFeatures[i];

                        supported = document.implementation.hasFeature(szFeature, "3.0") && supported;
                        supported = document.implementation.hasFeature(szFeature, "") && supported;
                        if (!supported)
                        {
                            break;
                        }
                    }

                    if (supported)
                    {
                        PassTest();
                    }
                    else
                    {
                        FailTest();
                    }
                }
                catch(ex)
                {
                    FailTest();
                }
            }
        </script>
    </head>
    <body>
        <h3>DOM Events</h3>
        <h4>
            Test Description: each interface defined in DOM Level 3 Events has a feature string,
            which may act as a base feature string or as an extended feature string.
        </h4>

        <p>Test passes if the word "PASS" appears below.</p>
           <div>Test result: </div>
        <div id='testresult'>FAIL</div>
    </body>
</html>