diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 7ee5e632900..0a42db03d5d 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -159,4 +159,9 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> { } } } + + // https://dom.spec.whatwg.org/#stringification-behavior + fn Stringifier(self) -> DOMString { + self.element.root().r().get_string_attribute(&self.local_name) + } } diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index f19e936ce54..91c25794716 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -106,6 +106,11 @@ impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> { self.data.borrow_mut().insert(name, vec!(value)); self.update_steps(); } + + // https://url.spec.whatwg.org/#stringification-behavior + fn Stringifier(self) -> DOMString { + DOMString::from_utf8(self.serialize(None)).unwrap() + } } pub trait URLSearchParamsHelpers { diff --git a/components/script/dom/webidls/DOMTokenList.webidl b/components/script/dom/webidls/DOMTokenList.webidl index 764f18d6dfa..61a3bebff15 100644 --- a/components/script/dom/webidls/DOMTokenList.webidl +++ b/components/script/dom/webidls/DOMTokenList.webidl @@ -17,5 +17,5 @@ interface DOMTokenList { [Throws] boolean toggle(DOMString token, optional boolean force); - //stringifier; + stringifier; }; diff --git a/components/script/dom/webidls/URLSearchParams.webidl b/components/script/dom/webidls/URLSearchParams.webidl index 3d61263cbc9..f0ddafad291 100644 --- a/components/script/dom/webidls/URLSearchParams.webidl +++ b/components/script/dom/webidls/URLSearchParams.webidl @@ -15,5 +15,5 @@ interface URLSearchParams { // sequence getAll(DOMString name); boolean has(DOMString name); void set(DOMString name, DOMString value); - //stringifier; + stringifier; }; diff --git a/tests/wpt/metadata/dom/interfaces.html.ini b/tests/wpt/metadata/dom/interfaces.html.ini index 3abf7a55e5d..14ac6621ede 100644 --- a/tests/wpt/metadata/dom/interfaces.html.ini +++ b/tests/wpt/metadata/dom/interfaces.html.ini @@ -825,9 +825,6 @@ [DOMTokenList interface: operation toggle(DOMString,boolean)] expected: FAIL - [DOMTokenList interface: stringifier] - expected: FAIL - [DOMTokenList interface: calling add(DOMString) on document.body.classList with too few arguments must throw TypeError] expected: FAIL diff --git a/tests/wpt/metadata/dom/nodes/Element-classlist.html.ini b/tests/wpt/metadata/dom/nodes/Element-classlist.html.ini index 9a6f69132ab..2526f96f80b 100644 --- a/tests/wpt/metadata/dom/nodes/Element-classlist.html.ini +++ b/tests/wpt/metadata/dom/nodes/Element-classlist.html.ini @@ -12,42 +12,12 @@ [classList.add must not cause the CSS selector to stop matching] expected: FAIL - [classList must stringify correctly when items have been added] - expected: FAIL - - [classList.add should not add a token if it already exists] - expected: FAIL - - [classList.remove removes arguments passed, if they are present.] - expected: FAIL - - [classList.remove must remove existing tokens] - expected: FAIL - [classList.remove must not break case-sensitive CSS selector matching] expected: FAIL - [classList.remove must collapse whitespace around removed tokens] - expected: FAIL - - [classList.remove must collapse whitespaces around each token] - expected: FAIL - - [classList.remove must collapse whitespaces around each token and remove duplicates] - expected: FAIL - - [classList.remove must collapse whitespace when removing duplicate tokens] - expected: FAIL - - [classList.add must collapse whitespaces and remove duplicates when adding a token that already exists] - expected: FAIL - [classList.toggle must not break case-sensitive CSS selector matching] expected: FAIL [CSS class selectors must stop matching when all classes have been removed] expected: FAIL - [classList must stringify to an empty string when all classes have been removed] - expected: FAIL -