Add CSSNamespaceRule.{namespaceURI, prefix}

This commit is contained in:
Manish Goregaokar 2016-11-17 16:53:54 -08:00
parent 64442090ba
commit 8108fc465a
3 changed files with 18 additions and 3 deletions

View file

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding;
use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding::CSSNamespaceRuleMethods;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
@ -38,6 +39,20 @@ impl CSSNamespaceRule {
}
}
impl CSSNamespaceRuleMethods for CSSNamespaceRule {
// https://drafts.csswg.org/cssom/#dom-cssnamespacerule-prefix
fn Prefix(&self) -> DOMString {
self.namespacerule.read().prefix
.as_ref().map(|s| s.to_string().into())
.unwrap_or(DOMString::new())
}
// https://drafts.csswg.org/cssom/#dom-cssnamespacerule-namespaceuri
fn NamespaceURI(&self) -> DOMString {
(*self.namespacerule.read().url).into()
}
}
impl SpecificCSSRule for CSSNamespaceRule {
fn ty(&self) -> u16 {
use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleConstants;

View file

@ -5,6 +5,6 @@
// https://drafts.csswg.org/cssom/#the-cssnamespacerule-interface
[Exposed=Window]
interface CSSNamespaceRule : CSSRule {
// readonly attribute DOMString namespaceURI;
// readonly attribute DOMString prefix;
readonly attribute DOMString namespaceURI;
readonly attribute DOMString prefix;
};