From fa912b01ea35c31fa53b7d17d1bb97a9e664accc Mon Sep 17 00:00:00 2001 From: Connor Brewster Date: Mon, 19 Dec 2016 09:04:13 -0700 Subject: [PATCH] Make datetime just reflect --- components/script/dom/htmltimeelement.rs | 16 +--------------- .../the-time-element/001.html | 9 +++------ 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs index 84794443e02..c5286dd685f 100644 --- a/components/script/dom/htmltimeelement.rs +++ b/components/script/dom/htmltimeelement.rs @@ -2,14 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::codegen::Bindings::ElementBinding::ElementBinding::ElementMethods; use dom::bindings::codegen::Bindings::HTMLTimeElementBinding; use dom::bindings::codegen::Bindings::HTMLTimeElementBinding::HTMLTimeElementMethods; -use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; use dom::bindings::str::DOMString; use dom::document::Document; -use dom::element::Element; use dom::htmlelement::HTMLElement; use dom::node::Node; use html5ever_atoms::LocalName; @@ -38,18 +35,7 @@ impl HTMLTimeElement { impl HTMLTimeElementMethods for HTMLTimeElement { // https://html.spec.whatwg.org/multipage/#dom-time-datetime - //make_getter!(DateTime, "datetime"); - fn DateTime(&self) -> DOMString { - let element = self.upcast::(); - if element.has_attribute(&local_name!("datetime")) { - return element.get_string_attribute(&local_name!("datetime")) - } else { - match element.GetInnerHTML() { - Ok(x) => x, - _ => DOMString::new(), - } - } - } + make_getter!(DateTime, "datetime"); // https://html.spec.whatwg.org/multipage/#dom-time-datetime make_setter!(SetDateTime, "datetime"); diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-time-element/001.html b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-time-element/001.html index e732e84e41f..1caceb5b3a7 100644 --- a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-time-element/001.html +++ b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-time-element/001.html @@ -58,12 +58,9 @@ test(function () { test(function () { assert_equals( makeTime('go fish').dateTime, 'go fish' ); }, 'the datetime attribute should be reflected by the .dateTime property even if it is invalid'); -test(function () { - assert_equals( makeTime(false,'2000-02-01T03:04:05Z', '2000-02-01').dateTime, '2000-02-01' ); -}, 'the datetime content attribute should not reflect the textContent when datetime attribute is present.'); -test(function () { - assert_equals( makeTime(false,'2000-02-01T03:04:05Z').dateTime, '2000-02-01T03:04:05Z' ); -}, 'the datetime content attribute should reflect the textContent when datetime attribute is absent.'); +test(function() { + assert_equals( makeTime(false,'2000-02-01T03:04:05Z').dateTime, '' ); +}, 'the datetime attribute should not reflect the textContent');