mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
More progress in the &JSRef -> JSRef conversion
Change all of the <Class>Methods traits to take `self` instead of `&self`.
This commit is contained in:
parent
2adc594e5d
commit
2c8d51a37c
66 changed files with 812 additions and 815 deletions
|
@ -71,27 +71,27 @@ impl<'a> PrivateDOMTokenListHelpers for JSRef<'a, DOMTokenList> {
|
|||
// http://dom.spec.whatwg.org/#domtokenlist
|
||||
impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
|
||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-length
|
||||
fn Length(&self) -> u32 {
|
||||
fn Length(self) -> u32 {
|
||||
self.attribute().root().map(|attr| {
|
||||
attr.value().tokens().map(|tokens| tokens.len()).unwrap_or(0)
|
||||
}).unwrap_or(0) as u32
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-item
|
||||
fn Item(&self, index: u32) -> Option<DOMString> {
|
||||
fn Item(self, index: u32) -> Option<DOMString> {
|
||||
self.attribute().root().and_then(|attr| attr.value().tokens().and_then(|mut tokens| {
|
||||
tokens.idx(index as uint).map(|token| token.as_slice().to_string())
|
||||
}))
|
||||
}
|
||||
|
||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<DOMString> {
|
||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
|
||||
let item = self.Item(index);
|
||||
*found = item.is_some();
|
||||
item
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-contains
|
||||
fn Contains(&self, token: DOMString) -> Fallible<bool> {
|
||||
fn Contains(self, token: DOMString) -> Fallible<bool> {
|
||||
self.check_token_exceptions(token.as_slice()).map(|slice| {
|
||||
self.attribute().root().and_then(|attr| attr.value().tokens().map(|mut tokens| {
|
||||
let atom = Atom::from_slice(slice);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue