servo: Merge #16170 - Implement HTMLAnchorElement.rel getter and setter (from TheKK:implement_html_anchor_element_rel); r=jdm

This PR makes code below possible:

```javascript
a = document.createElement("a");
a.rel = "foo";
console.log(a.rel); // print out "foo"
```
---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

Source-Repo: https://github.com/servo/servo
Source-Revision: 2e743c2c56d7841ed9135e72581bf7db5e1092b5

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0968bc1bd94b382611b548a7243b6831901722f9
This commit is contained in:
Ying-Ruei Liang(KK) 2017-03-30 17:25:31 -05:00
Родитель bf065fb0d0
Коммит 6d28e072df
2 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -113,11 +113,17 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
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
fn RelList(&self) -> Root<DOMTokenList> {
self.rel_list.or_init(|| {
DOMTokenList::new(self.upcast(), &local_name!("rel"))
})
self.rel_list.or_init(|| DOMTokenList::new(self.upcast(), &local_name!("rel")))
}
// https://html.spec.whatwg.org/multipage/#dom-a-coords

Просмотреть файл

@ -13,12 +13,12 @@
// https://html.spec.whatwg.org/multipage/#htmlanchorelement
interface HTMLAnchorElement : HTMLElement {
attribute DOMString target;
// attribute DOMString download;
// attribute USVString ping;
// attribute DOMString rel;
// attribute DOMString download;
// attribute USVString ping;
attribute DOMString rel;
readonly attribute DOMTokenList relList;
// attribute DOMString hreflang;
// attribute DOMString type;
// attribute DOMString hreflang;
// attribute DOMString type;
[Pure]
attribute DOMString text;