mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement HTMLAnchorElement.rel getter and setter
Signed-off-by: Ying-Ruei Liang(KK) <thumbd03803@gmail.com>
This commit is contained in:
parent
2084ee29c4
commit
bb6d52971a
13 changed files with 103 additions and 110 deletions
|
@ -113,11 +113,17 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
self.upcast::<Node>().SetTextContent(Some(value))
|
self.upcast::<Node>().SetTextContent(Some(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-a-rel
|
||||||
|
make_getter!(Rel, "rel");
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-a-rel
|
||||||
|
fn SetRel(&self, rel: DOMString) {
|
||||||
|
self.upcast::<Element>().set_tokenlist_attribute(&local_name!("rel"), rel);
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-a-rellist
|
// https://html.spec.whatwg.org/multipage/#dom-a-rellist
|
||||||
fn RelList(&self) -> Root<DOMTokenList> {
|
fn RelList(&self) -> Root<DOMTokenList> {
|
||||||
self.rel_list.or_init(|| {
|
self.rel_list.or_init(|| DOMTokenList::new(self.upcast(), &local_name!("rel")))
|
||||||
DOMTokenList::new(self.upcast(), &local_name!("rel"))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-a-coords
|
// https://html.spec.whatwg.org/multipage/#dom-a-coords
|
||||||
|
|
|
@ -15,7 +15,7 @@ interface HTMLAnchorElement : HTMLElement {
|
||||||
attribute DOMString target;
|
attribute DOMString target;
|
||||||
// attribute DOMString download;
|
// attribute DOMString download;
|
||||||
// attribute USVString ping;
|
// attribute USVString ping;
|
||||||
// attribute DOMString rel;
|
attribute DOMString rel;
|
||||||
readonly attribute DOMTokenList relList;
|
readonly attribute DOMTokenList relList;
|
||||||
// attribute DOMString hreflang;
|
// attribute DOMString hreflang;
|
||||||
// attribute DOMString type;
|
// attribute DOMString type;
|
||||||
|
|
|
@ -95034,6 +95034,18 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"html/semantics/text-level-semantics/the-a-element/a.rel-getter-01.html": [
|
||||||
|
[
|
||||||
|
"/html/semantics/text-level-semantics/the-a-element/a.rel-getter-01.html",
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"html/semantics/text-level-semantics/the-a-element/a.rel-setter-01.html": [
|
||||||
|
[
|
||||||
|
"/html/semantics/text-level-semantics/the-a-element/a.rel-setter-01.html",
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"html/semantics/text-level-semantics/the-a-element/a.text-getter-01.html": [
|
"html/semantics/text-level-semantics/the-a-element/a.text-getter-01.html": [
|
||||||
[
|
[
|
||||||
"/html/semantics/text-level-semantics/the-a-element/a.text-getter-01.html",
|
"/html/semantics/text-level-semantics/the-a-element/a.text-getter-01.html",
|
||||||
|
@ -178791,6 +178803,14 @@
|
||||||
"93f820588f813b3e340188c88be1532d6e549757",
|
"93f820588f813b3e340188c88be1532d6e549757",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
|
"html/semantics/text-level-semantics/the-a-element/a.rel-getter-01.html": [
|
||||||
|
"c207792ee550d653bc0734f6ef457c7c0e2749d8",
|
||||||
|
"testharness"
|
||||||
|
],
|
||||||
|
"html/semantics/text-level-semantics/the-a-element/a.rel-setter-01.html": [
|
||||||
|
"ea922ee6e02e02349ad56d1e8f69d6555d142883",
|
||||||
|
"testharness"
|
||||||
|
],
|
||||||
"html/semantics/text-level-semantics/the-a-element/a.text-getter-01.html": [
|
"html/semantics/text-level-semantics/the-a-element/a.text-getter-01.html": [
|
||||||
"ed1c631e5573192fc85f4234d76e5979a32bb44b",
|
"ed1c631e5573192fc85f4234d76e5979a32bb44b",
|
||||||
"testharness"
|
"testharness"
|
||||||
|
|
|
@ -1152,9 +1152,6 @@
|
||||||
[HTMLAnchorElement interface: attribute ping]
|
[HTMLAnchorElement interface: attribute ping]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLAnchorElement interface: attribute rel]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLAnchorElement interface: attribute hreflang]
|
[HTMLAnchorElement interface: attribute hreflang]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -1170,9 +1167,6 @@
|
||||||
[HTMLAnchorElement interface: document.createElement("a") must inherit property "ping" with the proper type (2)]
|
[HTMLAnchorElement interface: document.createElement("a") must inherit property "ping" with the proper type (2)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLAnchorElement interface: document.createElement("a") must inherit property "rel" with the proper type (3)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLAnchorElement interface: document.createElement("a") must inherit property "hreflang" with the proper type (5)]
|
[HTMLAnchorElement interface: document.createElement("a") must inherit property "hreflang" with the proper type (5)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -732,12 +732,6 @@
|
||||||
[a.ping: IDL set to object "test-valueOf" followed by IDL get]
|
[a.ping: IDL set to object "test-valueOf" followed by IDL get]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[a.rel: typeof IDL attribute]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL get with DOM attribute unset]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to "" followed by IDL get]
|
[a.rel: setAttribute() to "" followed by IDL get]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -24801,96 +24795,6 @@
|
||||||
[a.ping: IDL set to object "test-valueOf"]
|
[a.ping: IDL set to object "test-valueOf"]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[a.rel: setAttribute() to ""]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to 7]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to 1.5]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to true]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to false]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to object "[object Object\]"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to NaN]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to Infinity]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to -Infinity]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to "\\0"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to null]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to object "test-toString"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: setAttribute() to object "test-valueOf"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to ""]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to 7]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to 1.5]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to true]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to false]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to object "[object Object\]"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to NaN]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to Infinity]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to -Infinity]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to "\\0"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to null]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to object "test-toString"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.rel: IDL set to object "test-valueOf"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[a.hreflang: setAttribute() to ""]
|
[a.hreflang: setAttribute() to ""]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[generic.keep-origin-redirect.http.html]
|
||||||
|
type: testharness
|
||||||
|
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via a-tag using the rel-noreferrer\n delivery method with keep-origin-redirect and when\n the target request is cross-origin.]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[generic.no-redirect.http.html]
|
||||||
|
type: testharness
|
||||||
|
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via a-tag using the rel-noreferrer\n delivery method with no-redirect and when\n the target request is cross-origin.]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[generic.swap-origin-redirect.http.html]
|
||||||
|
type: testharness
|
||||||
|
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via a-tag using the rel-noreferrer\n delivery method with swap-origin-redirect and when\n the target request is cross-origin.]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[generic.keep-origin-redirect.http.html]
|
||||||
|
type: testharness
|
||||||
|
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via a-tag using the rel-noreferrer\n delivery method with keep-origin-redirect and when\n the target request is same-origin.]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[generic.no-redirect.http.html]
|
||||||
|
type: testharness
|
||||||
|
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via a-tag using the rel-noreferrer\n delivery method with no-redirect and when\n the target request is same-origin.]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[generic.swap-origin-redirect.http.html]
|
||||||
|
type: testharness
|
||||||
|
[The referrer URL is omitted when a\n document served over http requires an http\n sub-resource via a-tag using the rel-noreferrer\n delivery method with swap-origin-redirect and when\n the target request is same-origin.]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<title>HTMLAnchorElement.rel getter</title>
|
||||||
|
<link rel="author" title="TheKK" href="mailto:thumbd03803@gmail.com">
|
||||||
|
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-a-rel">
|
||||||
|
<script src=/resources/testharness.js></script>
|
||||||
|
<script src=/resources/testharnessreport.js></script>
|
||||||
|
<div id=log></div>
|
||||||
|
<div>
|
||||||
|
<a id="test" href="a" rel="noreferrer"></a>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
test(function() {
|
||||||
|
var a = document.getElementById("test");
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_equals(a.rel, "noreferrer");
|
||||||
|
}, "Test anchor's rel getter");
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<title>HTMLAnchorElement.rel setter</title>
|
||||||
|
<link rel="author" title="TheKK" href="mailto:thumbd03803@gmail.com">
|
||||||
|
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-a-rel">
|
||||||
|
<script src=/resources/testharness.js></script>
|
||||||
|
<script src=/resources/testharnessreport.js></script>
|
||||||
|
<div id=log></div>
|
||||||
|
<div>
|
||||||
|
<a id="test" href="a"></a>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
test(function() {
|
||||||
|
var a = document.getElementById("test");
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
a.rel = "noreferrer"
|
||||||
|
assert_equals(a.rel, "noreferrer");
|
||||||
|
}, "Test anchor's rel setter");
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue