features.html   [plain text]


<script>

function test() {

    var undefined;

    var features = [
        ["Core", undefined],
        ["HTML", undefined],
        ["XML", undefined],
        ["Views", undefined],
        ["StyleSheets", undefined],
        ["CSS", undefined],
        ["CSS2", undefined],
        ["CSS3", undefined],
        ["Events", undefined],
        ["UIEvents", undefined],
        ["MouseEvents", undefined],
        ["HTMLEvents", undefined],
        ["MutationEvents", undefined],
        ["Range", undefined],
        ["Traversal", undefined],

        ["Core", null],
        ["HTML", null],
        ["XML", null],
        ["Views", null],
        ["StyleSheets", null],
        ["CSS", null],
        ["CSS2", null],
        ["CSS3", null],
        ["Events", null],
        ["UIEvents", null],
        ["MouseEvents", null],
        ["HTMLEvents", null],
        ["MutationEvents", null],
        ["Range", null],
        ["Traversal", null],

        ["Core", ""],
        ["HTML", ""],
        ["XML", ""],
        ["Views", ""],
        ["StyleSheets", ""],
        ["CSS", ""],
        ["CSS2", ""],
        ["CSS3", ""],
        ["Events", ""],
        ["UIEvents", ""],
        ["MouseEvents", ""],
        ["HTMLEvents", ""],
        ["MutationEvents", ""],
        ["Range", ""],
        ["Traversal", ""],

        ["Core", "1.0"],
        ["HTML", "1.0"],
        ["XML", "1.0"],
        ["Views", "1.0"],
        ["StyleSheets", "1.0"],
        ["CSS", "1.0"],
        ["CSS2", "1.0"],
        ["CSS3", "1.0"],
        ["Events", "1.0"],
        ["UIEvents", "1.0"],
        ["MouseEvents", "1.0"],
        ["HTMLEvents", "1.0"],
        ["MutationEvents", "1.0"],
        ["Range", "1.0"],
        ["Traversal", "1.0"],

        ["Core", "2.0"],
        ["HTML", "2.0"],
        ["XML", "2.0"],
        ["Views", "2.0"],
        ["StyleSheets", "2.0"],
        ["CSS", "2.0"],
        ["CSS2", "2.0"],
        ["CSS3", "2.0"],
        ["Events", "2.0"],
        ["UIEvents", "2.0"],
        ["MouseEvents", "2.0"],
        ["HTMLEvents", "2.0"],
        ["MutationEvents", "2.0"],
        ["Range", "2.0"],
        ["Traversal", "2.0"],

        ["Core", "3.0"],
        ["HTML", "3.0"],
        ["XML", "3.0"],
        ["Views", "3.0"],
        ["StyleSheets", "3.0"],
        ["CSS", "3.0"],
        ["CSS2", "3.0"],
        ["CSS3", "3.0"],
        ["Events", "3.0"],
        ["UIEvents", "3.0"],
        ["MouseEvents", "3.0"],
        ["HTMLEvents", "3.0"],
        ["MutationEvents", "3.0"],
        ["Range", "3.0"],
        ["Traversal", "3.0"],

        ["Core", "nonsense"],
        ["HTML", "nonsense"],
        ["XML", "nonsense"],
        ["Views", "nonsense"],
        ["StyleSheets", "nonsense"],
        ["CSS", "nonsense"],
        ["CSS2", "nonsense"],
        ["CSS3", "nonsense"],
        ["Events", "nonsense"],
        ["UIEvents", "nonsense"],
        ["MouseEvents", "nonsense"],
        ["HTMLEvents", "nonsense"],
        ["MutationEvents", "nonsense"],
        ["Range", "nonsense"],
        ["Traversal", "nonsense"],

        [undefined, ""],
        [undefined, "1.0"],
        [undefined, "2.0"],
        [undefined, "3.0"],
        [undefined, "nonsense"],
        [undefined, undefined],
        [undefined, null],

        [null, ""],
        [null, "1.0"],
        [null, "2.0"],
        [null, "3.0"],
        [null, "nonsense"],
        [null, undefined],
        [null, null],

        ["nonsense", ""],
        ["nonsense", "1.0"],
        ["nonsense", "2.0"],
        ["nonsense", "3.0"],
        ["nonsense", "nonsense"],
        ["nonsense", undefined],
        ["nonsense", null],
    ];

    for (var i = 0; i < features.length; ++i)
    {
        var item = features[i];
        if (item[1] == "omitted") {
            var hasFeature = document.implementation.hasFeature(item[0]);
            var isSupported = document.body.isSupported(item[0]);
        } else {
            var hasFeature = document.implementation.hasFeature(item[0], item[1]);
            var isSupported = document.body.isSupported(item[0], item[1]);
        }

        var item0String = item[0];
        if (typeof item0String == "string")
            item0String = '"' + item0String + '"';
        var item1String = item[1];
        if (typeof item1String == "string" && item[1] != "omitted")
            item1String = '"' + item1String + '"';
        var message = item0String + ', ' + item1String + ': ' + hasFeature + ', ' + isSupported;

        var div = document.createElement('div');
        div.innerHTML = message;
        document.body.appendChild(div);
    }
}

</script>

<body onload="test()">
</body>