зеркало из https://github.com/mozilla/gecko-dev.git
Bug 801425 - Make hasFeature() and isSupported() always return true for non-SVG features; r=bz
This commit is contained in:
Родитель
17657dfb3c
Коммит
70c46f800c
|
@ -7097,57 +7097,19 @@ nsContentUtils::InternalIsSupported(nsISupports* aObject,
|
|||
const nsAString& aFeature,
|
||||
const nsAString& aVersion)
|
||||
{
|
||||
// Convert the incoming UTF16 strings to raw char*'s to save us some
|
||||
// code when doing all those string compares.
|
||||
NS_ConvertUTF16toUTF8 feature(aFeature);
|
||||
NS_ConvertUTF16toUTF8 version(aVersion);
|
||||
|
||||
const char *f = feature.get();
|
||||
const char *v = version.get();
|
||||
|
||||
if (PL_strcasecmp(f, "XML") == 0 ||
|
||||
PL_strcasecmp(f, "HTML") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "2.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "Views") == 0 ||
|
||||
PL_strcasecmp(f, "StyleSheets") == 0 ||
|
||||
PL_strcasecmp(f, "Core") == 0 ||
|
||||
PL_strcasecmp(f, "CSS") == 0 ||
|
||||
PL_strcasecmp(f, "CSS2") == 0 ||
|
||||
PL_strcasecmp(f, "Events") == 0 ||
|
||||
PL_strcasecmp(f, "UIEvents") == 0 ||
|
||||
PL_strcasecmp(f, "MouseEvents") == 0 ||
|
||||
// Non-standard!
|
||||
PL_strcasecmp(f, "MouseScrollEvents") == 0 ||
|
||||
PL_strcasecmp(f, "HTMLEvents") == 0 ||
|
||||
PL_strcasecmp(f, "Range") == 0 ||
|
||||
PL_strcasecmp(f, "XHTML") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "2.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "XPath") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "3.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
|
||||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
|
||||
nsSVGFeatures::HasFeature(aObject, aFeature)) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "1.1") == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (NS_SMILEnabled() && PL_strcasecmp(f, "TimeControl") == 0) {
|
||||
if (aVersion.IsEmpty() || PL_strcmp(v, "1.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
// If it looks like an SVG feature string, forward to nsSVGFeatures
|
||||
if (StringBeginsWith(aFeature,
|
||||
NS_LITERAL_STRING("http://www.w3.org/TR/SVG"),
|
||||
nsASCIICaseInsensitiveStringComparator()) ||
|
||||
StringBeginsWith(aFeature, NS_LITERAL_STRING("org.w3c.dom.svg"),
|
||||
nsASCIICaseInsensitiveStringComparator()) ||
|
||||
StringBeginsWith(aFeature, NS_LITERAL_STRING("org.w3c.svg"),
|
||||
nsASCIICaseInsensitiveStringComparator())) {
|
||||
return (aVersion.IsEmpty() || aVersion.EqualsLiteral("1.0") ||
|
||||
aVersion.EqualsLiteral("1.1")) &&
|
||||
nsSVGFeatures::HasFeature(aObject, aFeature);
|
||||
}
|
||||
|
||||
return false;
|
||||
// Otherwise, we claim to support everything
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -41,26 +41,26 @@ var features = [
|
|||
["Events", "2.0", true],
|
||||
["UIEvents", "2.0", true],
|
||||
["MouseEvents", "2.0", true],
|
||||
["MutationEvents", "2.0", false],
|
||||
["MutationEvents", "2.0", true],
|
||||
["HTMLEvents", "2.0", true],
|
||||
["Range", "2.0", true],
|
||||
["Traversal", "2.0", false],
|
||||
["Traversal", "2.0", true],
|
||||
|
||||
// DOM Level 3
|
||||
// http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
|
||||
["Core", "3.0", false],
|
||||
["XML", "3.0", false],
|
||||
["Events", "3.0", false],
|
||||
["UIEvents", "3.0", false],
|
||||
["MouseEvents", "3.0", false],
|
||||
["TextEvents", "3.0", false],
|
||||
["KeyboardEvents", "3.0", false],
|
||||
["MutationEvents", "3.0", false],
|
||||
["MutationNameEvents", "3.0", false],
|
||||
["HTMLEvents", "3.0", false],
|
||||
["LS", "3.0", false],
|
||||
["LS-Async", "3.0", false],
|
||||
["Validation", "3.0", false],
|
||||
["Core", "3.0", true],
|
||||
["XML", "3.0", true],
|
||||
["Events", "3.0", true],
|
||||
["UIEvents", "3.0", true],
|
||||
["MouseEvents", "3.0", true],
|
||||
["TextEvents", "3.0", true],
|
||||
["KeyboardEvents", "3.0", true],
|
||||
["MutationEvents", "3.0", true],
|
||||
["MutationNameEvents", "3.0", true],
|
||||
["HTMLEvents", "3.0", true],
|
||||
["LS", "3.0", true],
|
||||
["LS-Async", "3.0", true],
|
||||
["Validation", "3.0", true],
|
||||
["XPath", "3.0", "true"],
|
||||
|
||||
// current SVG feature string support status:
|
||||
|
|
|
@ -36,7 +36,6 @@ MOCHITEST_FILES := \
|
|||
test_DOMImplementation-createDocument.html \
|
||||
test_DOMImplementation-createDocumentType.html \
|
||||
test_DOMImplementation-createHTMLDocument.html \
|
||||
test_DOMImplementation-hasFeature.html \
|
||||
test_Element-childElementCount-dynamic-add.html \
|
||||
test_Element-childElementCount-dynamic-add.svg \
|
||||
test_Element-childElementCount-dynamic-add.xhtml \
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>DOMImplementation.hasFeature(feature, version)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var tests = [
|
||||
["Core", "1.0", false],
|
||||
["Core", "2.0", true],
|
||||
["Core", "3.0", false],
|
||||
["Core", "100.0", false],
|
||||
["XML", "1.0", true],
|
||||
["XML", "2.0", true],
|
||||
["XML", "3.0", false],
|
||||
["XML", "100.0", false],
|
||||
["Core", "1", false],
|
||||
["Core", "2", false],
|
||||
["Core", "3", false],
|
||||
["Core", "100", false],
|
||||
["XML", "1", false],
|
||||
["XML", "2", false],
|
||||
["XML", "3", false],
|
||||
["XML", "100", false],
|
||||
["Core", "1.1", false],
|
||||
["Core", "2.1", false],
|
||||
["Core", "3.1", false],
|
||||
["Core", "100.1", false],
|
||||
["XML", "1.1", false],
|
||||
["XML", "2.1", false],
|
||||
["XML", "3.1", false],
|
||||
["XML", "100.1", false],
|
||||
["Core", "", true],
|
||||
["XML", "", true],
|
||||
["core", "", true],
|
||||
["xml", "", true],
|
||||
["CoRe", "", true],
|
||||
["XmL", "", true],
|
||||
[" Core", "", false],
|
||||
[" XML", "", false],
|
||||
["Core ", "", false],
|
||||
["XML ", "", false],
|
||||
["Co re", "", false],
|
||||
["XM L", "", false],
|
||||
["aCore", "", false],
|
||||
["aXML", "", false],
|
||||
["Corea", "", false],
|
||||
["XMLa", "", false],
|
||||
["Coare", "", false],
|
||||
["XMaL", "", false],
|
||||
["Core", " ", false],
|
||||
["XML", " ", false],
|
||||
["Core", " 1.0", false],
|
||||
["Core", " 2.0", false],
|
||||
["Core", " 3.0", false],
|
||||
["Core", " 100.0", false],
|
||||
["XML", " 1.0", false],
|
||||
["XML", " 2.0", false],
|
||||
["XML", " 3.0", false],
|
||||
["XML", " 100.0", false],
|
||||
["Core", "1.0 ", false],
|
||||
["Core", "2.0 ", false],
|
||||
["Core", "3.0 ", false],
|
||||
["Core", "100.0 ", false],
|
||||
["XML", "1.0 ", false],
|
||||
["XML", "2.0 ", false],
|
||||
["XML", "3.0 ", false],
|
||||
["XML", "100.0 ", false],
|
||||
["Core", "1. 0", false],
|
||||
["Core", "2. 0", false],
|
||||
["Core", "3. 0", false],
|
||||
["Core", "100. 0", false],
|
||||
["XML", "1. 0", false],
|
||||
["XML", "2. 0", false],
|
||||
["XML", "3. 0", false],
|
||||
["XML", "100. 0", false],
|
||||
["Core", "a1.0", false],
|
||||
["Core", "a2.0", false],
|
||||
["Core", "a3.0", false],
|
||||
["Core", "a100.0", false],
|
||||
["XML", "a1.0", false],
|
||||
["XML", "a2.0", false],
|
||||
["XML", "a3.0", false],
|
||||
["XML", "a100.0", false],
|
||||
["Core", "1.0a", false],
|
||||
["Core", "2.0a", false],
|
||||
["Core", "3.0a", false],
|
||||
["Core", "100.0a", false],
|
||||
["XML", "1.0a", false],
|
||||
["XML", "2.0a", false],
|
||||
["XML", "3.0a", false],
|
||||
["XML", "100.0a", false],
|
||||
["Core", "1.a0", false],
|
||||
["Core", "2.a0", false],
|
||||
["Core", "3.a0", false],
|
||||
["Core", "100.a0", false],
|
||||
["XML", "1.a0", false],
|
||||
["XML", "2.a0", false],
|
||||
["XML", "3.a0", false],
|
||||
["XML", "100.a0", false],
|
||||
["Core", 1, false],
|
||||
["Core", 2, false],
|
||||
["Core", 3, false],
|
||||
["Core", 100, false],
|
||||
["XML", 1, false],
|
||||
["XML", 2, false],
|
||||
["XML", 3, false],
|
||||
["XML", 100, false],
|
||||
["Core", null, true],
|
||||
["XML", null, true],
|
||||
["core", null, true],
|
||||
["xml", null, true],
|
||||
["CoRe", null, true],
|
||||
["XmL", null, true],
|
||||
[" Core", null, false],
|
||||
[" XML", null, false],
|
||||
["Core ", null, false],
|
||||
["XML ", null, false],
|
||||
["Co re", null, false],
|
||||
["XM L", null, false],
|
||||
["aCore", null, false],
|
||||
["aXML", null, false],
|
||||
["Corea", null, false],
|
||||
["XMLa", null, false],
|
||||
["Coare", null, false],
|
||||
["XMaL", null, false],
|
||||
["Core", undefined, false],
|
||||
["XML", undefined, false],
|
||||
["This is filler text.", "", false],
|
||||
[null, "", false],
|
||||
[undefined, "", false],
|
||||
]
|
||||
for (var i in tests) {
|
||||
var test = tests[i]
|
||||
assert_equals(document.implementation.hasFeature(test[0], test[1]), test[2], test[0] + " " + test[1])
|
||||
}
|
||||
})
|
||||
</script>
|
|
@ -97,7 +97,6 @@ MOCHITEST_FILES_B = \
|
|||
test_domimplementationfeaturecore.html \
|
||||
test_domimplementationfeaturexmlversion2.html \
|
||||
test_domimplementationhasfeature01.html \
|
||||
test_domimplementationhasfeature02.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_FILES_C = \
|
||||
|
@ -191,8 +190,6 @@ MOCHITEST_FILES_D = \
|
|||
test_importNode16.html \
|
||||
test_importNode17.html \
|
||||
test_internalSubset01.html \
|
||||
test_isSupported01.html \
|
||||
test_isSupported02.html \
|
||||
test_isSupported04.html \
|
||||
test_isSupported05.html \
|
||||
test_isSupported06.html \
|
||||
|
@ -251,9 +248,7 @@ MOCHITEST_FILES_E = \
|
|||
test_nodehasattributes04.html \
|
||||
test_nodeissupported01.html \
|
||||
test_nodeissupported02.html \
|
||||
test_nodeissupported03.html \
|
||||
test_nodeissupported04.html \
|
||||
test_nodeissupported05.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_FILES_F = \
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationhasfeature02</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="DOMTestCase.js"></script>
|
||||
<script type="text/javascript" src="exclusions.js"></script>
|
||||
<script type="text/javascript">
|
||||
// expose test function names
|
||||
function exposeTestFunctionNames()
|
||||
{
|
||||
return ['domimplementationhasfeature02'];
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "staffNS");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
runJSUnitTests();
|
||||
markTodos();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var docName = 'domimplementationhasfeature02';
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The method "hasFeature(feature,version)" tests if the DOMImplementation implements
|
||||
a specific feature and if not returns false.
|
||||
|
||||
Call the hasFeature method on this DOMImplementation with a unfimiliar values for
|
||||
feature and version. Check if the value returned was false.
|
||||
|
||||
* @author IBM
|
||||
* @author Neil Delima
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
|
||||
*/
|
||||
function domimplementationhasfeature02() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "domimplementationhasfeature02") != null) return;
|
||||
var doc;
|
||||
var domImpl;
|
||||
var success;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "staffNS");
|
||||
domImpl = doc.implementation;
|
||||
success = domImpl.hasFeature("Blah Blah","");
|
||||
assertFalse("domimplementationhasfeature02",success);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationhasfeature02</h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,125 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported01</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="DOMTestCase.js"></script>
|
||||
<script type="text/javascript" src="exclusions.js"></script>
|
||||
<script type="text/javascript">
|
||||
// expose test function names
|
||||
function exposeTestFunctionNames()
|
||||
{
|
||||
return ['isSupported01'];
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
runJSUnitTests();
|
||||
markTodos();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var docName = 'isSupported01';
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "feature" parameter in the
|
||||
isSupported(feature,version)" method is the name
|
||||
of the feature and the version is the version number of the
|
||||
feature to test. XXX is NOT a legal value for the feature parameter.
|
||||
The method should return "false" since XXX is not a valid feature.
|
||||
|
||||
Retrieve the root node of the DOM document by invoking
|
||||
the "getDocumentElement()" method. This should create a
|
||||
node object on which the "isSupported(feature,version)"
|
||||
method is invoked with "feature" equal to "XXX" and version to "1.0".
|
||||
The method should return a boolean "false" since XXX is not a valid feature.
|
||||
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports
|
||||
*/
|
||||
function isSupported01() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "isSupported01") != null) return;
|
||||
var doc;
|
||||
var rootNode;
|
||||
var state;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "staff");
|
||||
rootNode = doc.documentElement;
|
||||
|
||||
state = rootNode.isSupported("XXX","1.0");
|
||||
assertFalse("throw_False",state);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported01</h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,125 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported02</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="DOMTestCase.js"></script>
|
||||
<script type="text/javascript" src="exclusions.js"></script>
|
||||
<script type="text/javascript">
|
||||
// expose test function names
|
||||
function exposeTestFunctionNames()
|
||||
{
|
||||
return ['isSupported02'];
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
runJSUnitTests();
|
||||
markTodos();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var docName = 'isSupported02';
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "feature" parameter in the
|
||||
isSupported(feature,version)" method is the name
|
||||
of the feature and the version is the version number of the
|
||||
feature to test. XML is a legal value for the feature parameter.
|
||||
The method should return "false" since 9.0 is not a valid version.
|
||||
|
||||
Retrieve the root node of the DOM document by invoking
|
||||
the "getDocumentElement()" method. This should create a
|
||||
node object on which the "isSupported(feature,version)"
|
||||
method is invoked with "feature" equal to "XML" and version to "9.0".
|
||||
The method should return a boolean "false" since 9.0 is not a valid version.
|
||||
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports
|
||||
*/
|
||||
function isSupported02() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "isSupported02") != null) return;
|
||||
var doc;
|
||||
var rootNode;
|
||||
var state;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "staff");
|
||||
rootNode = doc.documentElement;
|
||||
|
||||
state = rootNode.isSupported("XML","9.0");
|
||||
assertFalse("throw_False",state);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported02</h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,119 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodeissupported03</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="DOMTestCase.js"></script>
|
||||
<script type="text/javascript" src="exclusions.js"></script>
|
||||
<script type="text/javascript">
|
||||
// expose test function names
|
||||
function exposeTestFunctionNames()
|
||||
{
|
||||
return ['nodeissupported03'];
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "staffNS");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
runJSUnitTests();
|
||||
markTodos();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var docName = 'nodeissupported03';
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The method "isSupported(feature,version)" Tests whether the DOM implementation
|
||||
implements a specific feature and that feature is supported by this node.
|
||||
|
||||
Call the isSupported method specifying empty strings for feature and version on a docType
|
||||
Node. Check if the value returned value was false.
|
||||
|
||||
* @author IBM
|
||||
* @author Neil Delima
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports
|
||||
*/
|
||||
function nodeissupported03() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "nodeissupported03") != null) return;
|
||||
var doc;
|
||||
var docType;
|
||||
var success;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "staffNS");
|
||||
docType = doc.doctype;
|
||||
|
||||
success = docType.isSupported("","");
|
||||
assertFalse("nodeissupported03",success);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodeissupported03</h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,118 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodeissupported05</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="DOMTestCase.js"></script>
|
||||
<script type="text/javascript" src="exclusions.js"></script>
|
||||
<script type="text/javascript">
|
||||
// expose test function names
|
||||
function exposeTestFunctionNames()
|
||||
{
|
||||
return ['nodeissupported05'];
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "staffNS");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPage = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
runJSUnitTests();
|
||||
markTodos();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var docName = 'nodeissupported05';
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The method "isSupported(feature,version)" Tests whether the DOM implementation
|
||||
implements a specific feature and that feature is supported by this node.
|
||||
|
||||
Call the isSupported method specifying bad values for feature and version on a new
|
||||
Processing Instruction node. Check if the value returned from this method value was false.
|
||||
|
||||
* @author IBM
|
||||
* @author Neil Delima
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports
|
||||
*/
|
||||
function nodeissupported05() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "nodeissupported05") != null) return;
|
||||
var doc;
|
||||
var pi;
|
||||
var success;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "staffNS");
|
||||
pi = doc.createProcessingInstruction("PITarget","PIData");
|
||||
success = pi.isSupported("-","+");
|
||||
assertFalse("nodeissupported05",success);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodeissupported05</h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче