mirror of
https://github.com/servo/servo.git
synced 2025-08-23 14:25:33 +01:00
Update web-platform-tests to revision 5dbe45af3ad3a933c03187c72f1c12cbe2877703
This commit is contained in:
parent
6c0eb115f4
commit
9aa1b1e408
129 changed files with 2604 additions and 290 deletions
62
tests/wpt/web-platform-tests/url/a-element-xhtml.xhtml
Normal file
62
tests/wpt/web-platform-tests/url/a-element-xhtml.xhtml
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>URL Test</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/" />
|
||||
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#urls" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="urltestparser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
<![CDATA[
|
||||
var setup = async_test("Loading data…")
|
||||
setup.step(function() {
|
||||
var request = new XMLHttpRequest()
|
||||
request.open("GET", "urltestdata.txt")
|
||||
request.send()
|
||||
request.responseType = "text"
|
||||
request.onload = setup.step_func(function() {
|
||||
runURLTests(request.response);
|
||||
setup.done()
|
||||
})
|
||||
})
|
||||
|
||||
function setBase(base) {
|
||||
document.body.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:base", base);
|
||||
}
|
||||
|
||||
function bURL(url, base) {
|
||||
base = base || "about:blank"
|
||||
setBase(base)
|
||||
var a = document.createElement("a")
|
||||
a.setAttribute("href", url)
|
||||
document.body.appendChild(a)
|
||||
return a
|
||||
}
|
||||
|
||||
function runURLTests(raw) {
|
||||
var urltests = URLTestParser(raw)
|
||||
for(var i = 0, l = urltests.length; i < l; i++) {
|
||||
var expected = urltests[i]
|
||||
test(function() {
|
||||
var url = bURL(expected.input, expected.base)
|
||||
if(expected.protocol === ':' && url.protocol !== ':')
|
||||
assert_unreached('Expected URL to fail parsing')
|
||||
assert_equals(url.protocol, expected.protocol, "scheme")
|
||||
assert_equals(url.hostname, expected.hostname, "host")
|
||||
assert_equals(url.port, expected.port, "port")
|
||||
assert_equals(url.pathname, expected.path, "path")
|
||||
assert_equals(url.search, expected.search, "search")
|
||||
assert_equals(url.hash, expected.hash, "hash")
|
||||
assert_equals(url.href, expected.href, "href")
|
||||
}, "Parsing: <" + expected.input + "> against <" + expected.base + ">")
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue