mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Cargoify servo
This commit is contained in:
parent
db2f642c32
commit
c6ab60dbfc
1761 changed files with 8423 additions and 2294 deletions
66
tests/content/test_element_attribute.html
Normal file
66
tests/content/test_element_attribute.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<html>
|
||||
<head id="foo">
|
||||
<title></title>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="test" foo="bar"></div>
|
||||
<script>
|
||||
let test = document.getElementById("test");
|
||||
|
||||
{
|
||||
let r1 = test.getAttribute("id");
|
||||
is(r1, "test", "test1-0, Element.getAttribute().");
|
||||
let r2 = test.getAttribute("foo");
|
||||
is(r2, "bar", "test1-1, Element.getAttribute().");
|
||||
}
|
||||
|
||||
{
|
||||
let NAME = "hoge";
|
||||
let VALUE = "fuga";
|
||||
test.setAttribute(NAME, VALUE);
|
||||
let r = test.getAttribute(NAME);
|
||||
is(r, VALUE, "test2. Element.setAttribute().");
|
||||
}
|
||||
|
||||
{
|
||||
let NAME = "foo";
|
||||
let VALUE = "mozilla";
|
||||
test.setAttribute(NAME, VALUE);
|
||||
let r = test.getAttribute(NAME);
|
||||
is(r, VALUE, "test3, attribute update by Element.setAttribute().")
|
||||
}
|
||||
|
||||
{
|
||||
test.setAttribute("id", "bar");
|
||||
test.removeAttribute("id");
|
||||
|
||||
let r1 = test.hasAttribute("id");
|
||||
is(r1, false, "test4-0, Element.removeAttribute().");
|
||||
let r2 = test.getAttribute("id");
|
||||
is(r2, null, "test4-1, Element.removeAttribute().");
|
||||
}
|
||||
|
||||
{
|
||||
test.setAttribute("xml:lang", "en");
|
||||
|
||||
let r1 = test.hasAttribute("xml:lang");
|
||||
is(r1, true, "test5-0, Element.setAttribute('xml:lang').");
|
||||
let r2 = test.getAttribute("xml:lang");
|
||||
is_not(r2, null, "test5-1, Element.setAttribute('xml:lang').");
|
||||
}
|
||||
|
||||
should_throw(function () {
|
||||
test.setAttributeNS("http://example.com", "xmlns", "foo");
|
||||
});
|
||||
should_throw(function () {
|
||||
test.setAttributeNS("http://www.w3.org/2000/xmlns/", "attr", "value");
|
||||
});
|
||||
should_throw(function () {
|
||||
test.setAttributeNS("http://www.w3.org/2000/xmlns/", "prefix:attr", "value");
|
||||
});
|
||||
|
||||
finish();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue