diff --git a/src/components/script/dom/attr.rs b/src/components/script/dom/attr.rs index 310dc2f3de6..f963ae962c9 100644 --- a/src/components/script/dom/attr.rs +++ b/src/components/script/dom/attr.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::AttrBinding; use dom::bindings::utils::{Reflectable, Reflector, DOMString}; -use dom::bindings::utils::{reflect_dom_object, null_str_as_empty}; +use dom::bindings::utils::reflect_dom_object; use dom::namespace::{Namespace, Null}; use dom::window::Window; @@ -16,7 +16,7 @@ pub struct Attr { value: ~str, name: ~str, namespace: Namespace, - prefix: DOMString + prefix: Option } impl Reflectable for Attr { @@ -70,26 +70,26 @@ impl Attr { } pub fn LocalName(&self) -> DOMString { - Some(self.local_name().to_owned()) + self.local_name().to_owned() } pub fn Value(&self) -> DOMString { - Some(self.value.clone()) + self.value.clone() } pub fn SetValue(&mut self, value: &DOMString) { - self.value = null_str_as_empty(value); + self.value = value.clone(); } pub fn Name(&self) -> DOMString { - Some(self.name.clone()) + self.name.clone() } - pub fn GetNamespaceURI(&self) -> DOMString { + pub fn GetNamespaceURI(&self) -> Option { self.namespace.to_str() } - pub fn GetPrefix(&self) -> DOMString { + pub fn GetPrefix(&self) -> Option { self.prefix.clone() } } diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 9f333ca6e75..05255b95792 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -1066,9 +1066,6 @@ for (uint32_t i = 0; i < length; ++i) { def getConversionCode(varName, isOptional=False): strval = "strval" - if not type.nullable(): - # XXX #1207 Actually pass non-nullable strings to callees. - strval = "Some(%s)" % strval if isOptional: strval = "Some(%s)" % strval if type.nullable(): @@ -1092,7 +1089,7 @@ for (uint32_t i = 0; i < length; ++i) { return handleDefault( conversionCode, ("static data: [u8, ..%s] = [ %s ];\n" - "%s = Some(str::from_utf8(data));" % + "%s = str::from_utf8(data)" % (len(defaultValue.value) + 1, ", ".join(["'" + char + "' as u8" for char in defaultValue.value] + ["0"]), varName))) @@ -1109,12 +1106,14 @@ for (uint32_t i = 0; i < length; ++i) { "}\n" % CGIndenter(CGGeneric(getConversionCode("str"))).define(), declType, None, isOptional, None) + declType = "DOMString" + initialValue = None + if type.nullable(): + declType = "Option<%s>" % declType + if isOptional: - declType = "Option" + declType = "Option<%s>" % declType initialValue = "None" - else: - declType = "DOMString" - initialValue = None return ( "%s\n" % @@ -1587,8 +1586,7 @@ for (uint32_t i = 0; i < length; ++i) { if type.nullable(): return (wrapAndSetPtr("*${jsvalPtr} = domstring_to_jsval(cx, &%s)" % result), False) else: - #XXXjdm Can we be smarter when we know it's not nullable? - return (wrapAndSetPtr("*${jsvalPtr} = domstring_to_jsval(cx, &%s)" % result), False) + return (wrapAndSetPtr("*${jsvalPtr} = str_to_jsval(cx, &%s)" % result), False) if type.isEnum(): if type.nullable(): @@ -1722,7 +1720,10 @@ def getRetvalDeclarationForType(returnType, descriptorProvider, result = CGWrapper(result, pre="Nullable<", post=">") return result, False if returnType.isString(): - return CGGeneric("DOMString"), False + result = CGGeneric("DOMString") + if returnType.nullable(): + result = CGWrapper(result, pre="Option<", post=">") + return result, False if returnType.isEnum(): if returnType.nullable(): raise TypeError("We don't support nullable enum return values") @@ -2960,8 +2961,8 @@ class CGCallGenerator(CGThing): if a.type.isObject() and not a.type.nullable() and not a.optional: name = "(JSObject&)" + name #XXXjdm Perhaps we should pass all nontrivial types by borrowed pointer - # Aoid passing Option by reference. If only one of optional or - # defaultValue are truthy we pass an Option, otherwise it's a concrete DOMString. + # Aoid passing Option> by reference. If only one of optional or + # defaultValue are truthy we pass an Option, otherwise it's a concrete Option. if a.type.isDictionary() or (a.type.isString() and not (bool(a.defaultValue) ^ a.optional)): name = "&" + name args.append(CGGeneric(name)) diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index 6fa2a8ec0c3..f3f24b34cc9 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -116,9 +116,9 @@ extern fn InterfaceObjectToString(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) } } -pub type DOMString = Option<~str>; +pub type DOMString = ~str; -pub fn null_str_as_empty(s: &DOMString) -> ~str { +pub fn null_str_as_empty(s: &Option) -> ~str { // We don't use map_default because it would allocate ~"" even for Some. match *s { Some(ref s) => s.clone(), @@ -126,14 +126,14 @@ pub fn null_str_as_empty(s: &DOMString) -> ~str { } } -pub fn null_str_as_empty_ref<'a>(s: &'a DOMString) -> &'a str { +pub fn null_str_as_empty_ref<'a>(s: &'a Option) -> &'a str { match *s { Some(ref s) => s.as_slice(), None => &'a "" } } -pub fn null_str_as_word_null(s: &DOMString) -> ~str { +pub fn null_str_as_word_null(s: &Option) -> ~str { // We don't use map_default because it would allocate ~"null" even for Some. match *s { Some(ref s) => s.clone(), @@ -259,7 +259,7 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal, } #[fixed_stack_segment] -pub fn jsval_to_domstring(cx: *JSContext, v: JSVal) -> Result { +pub fn jsval_to_domstring(cx: *JSContext, v: JSVal) -> Result, ()> { if jsval::is_null(v) || jsval::is_undefined(v) { Ok(None) } else { @@ -273,18 +273,23 @@ pub fn jsval_to_domstring(cx: *JSContext, v: JSVal) -> Result { } #[fixed_stack_segment] -pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal { +pub unsafe fn str_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal { + do string.to_utf16().as_imm_buf |buf, len| { + let jsstr = JS_NewUCStringCopyN(cx, buf, len as libc::size_t); + if jsstr.is_null() { + // FIXME: is there something else we should do on failure? + JSVAL_NULL + } else { + RUST_STRING_TO_JSVAL(jsstr) + } + } +} + +#[fixed_stack_segment] +pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &Option) -> JSVal { match string { &None => JSVAL_NULL, - &Some(ref s) => do s.to_utf16().as_imm_buf |buf, len| { - let jsstr = JS_NewUCStringCopyN(cx, buf, len as libc::size_t); - if jsstr.is_null() { - // FIXME: is there something else we should do on failure? - JSVAL_NULL - } else { - RUST_STRING_TO_JSVAL(jsstr) - } - } + &Some(ref s) => str_to_jsval(cx, s), } } diff --git a/src/components/script/dom/characterdata.rs b/src/components/script/dom/characterdata.rs index f84ebbbdb50..19a205cf5c4 100644 --- a/src/components/script/dom/characterdata.rs +++ b/src/components/script/dom/characterdata.rs @@ -23,11 +23,11 @@ impl CharacterData { } pub fn Data(&self) -> DOMString { - Some(self.data.clone()) + self.data.clone() } pub fn SetData(&mut self, arg: &DOMString) -> ErrorResult { - self.data = arg.get_ref().clone(); + self.data = arg.clone(); Ok(()) } @@ -36,11 +36,11 @@ impl CharacterData { } pub fn SubstringData(&self, offset: u32, count: u32) -> Fallible { - Ok(Some(self.data.slice(offset as uint, count as uint).to_str())) + Ok(self.data.slice(offset as uint, count as uint).to_str()) } pub fn AppendData(&mut self, arg: &DOMString) -> ErrorResult { - self.data.push_str(arg.get_ref().clone()); + self.data.push_str(*arg); Ok(()) } diff --git a/src/components/script/dom/comment.rs b/src/components/script/dom/comment.rs index bd238af7b50..2e71b99a868 100644 --- a/src/components/script/dom/comment.rs +++ b/src/components/script/dom/comment.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::CommentBinding; -use dom::bindings::utils::{DOMString, Fallible, null_str_as_empty}; +use dom::bindings::utils::{DOMString, Fallible}; use dom::characterdata::CharacterData; use dom::document::AbstractDocument; use dom::node::{AbstractNode, ScriptView, CommentNodeTypeId, Node}; @@ -27,6 +27,6 @@ impl Comment { } pub fn Constructor(owner: @mut Window, data: &DOMString) -> Fallible> { - Ok(Comment::new(null_str_as_empty(data), owner.Document())) + Ok(Comment::new(data.clone(), owner.Document())) } } diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs index e7542fc8975..f639f7e3b0c 100644 --- a/src/components/script/dom/document.rs +++ b/src/components/script/dom/document.rs @@ -6,7 +6,7 @@ use dom::comment::Comment; use dom::bindings::codegen::DocumentBinding; use dom::bindings::utils::{Reflectable, Reflector, Traceable, reflect_dom_object}; use dom::bindings::utils::{ErrorResult, Fallible, NotSupported, InvalidCharacter}; -use dom::bindings::utils::{DOMString, null_str_as_empty_ref, null_str_as_empty, null_str_as_word_null}; +use dom::bindings::utils::DOMString; use dom::bindings::utils::{xml_name_type, InvalidXMLName}; use dom::documentfragment::DocumentFragment; use dom::element::{Element}; @@ -181,10 +181,10 @@ impl Document { } pub fn GetElementsByTagName(&self, tag: &DOMString) -> @mut HTMLCollection { - self.createHTMLCollection(|elem| eq_slice(elem.tag_name, null_str_as_empty(tag))) + self.createHTMLCollection(|elem| eq_slice(elem.tag_name, *tag)) } - pub fn GetElementsByTagNameNS(&self, _ns: &DOMString, _tag: &DOMString) -> @mut HTMLCollection { + pub fn GetElementsByTagNameNS(&self, _ns: &Option, _tag: &DOMString) -> @mut HTMLCollection { HTMLCollection::new(self.window, ~[]) } @@ -193,18 +193,16 @@ impl Document { } pub fn GetElementById(&self, id: &DOMString) -> Option> { - let key: &~str = &null_str_as_empty(id); // TODO: "in tree order, within the context object's tree" // http://dom.spec.whatwg.org/#dom-document-getelementbyid. - match self.idmap.find_equiv(key) { + match self.idmap.find_equiv(id) { None => None, Some(node) => Some(*node), } } pub fn CreateElement(&self, abstract_self: AbstractDocument, local_name: &DOMString) -> Fallible> { - let local_name = null_str_as_empty(local_name); - if xml_name_type(local_name) == InvalidXMLName { + if xml_name_type(*local_name) == InvalidXMLName { return Err(InvalidCharacter); } let local_name = local_name.to_ascii_lower(); @@ -216,15 +214,15 @@ impl Document { } pub fn CreateTextNode(&self, abstract_self: AbstractDocument, data: &DOMString) -> AbstractNode { - Text::new(null_str_as_empty(data), abstract_self) + Text::new(data.clone(), abstract_self) } pub fn CreateComment(&self, abstract_self: AbstractDocument, data: &DOMString) -> AbstractNode { - Comment::new(null_str_as_word_null(data), abstract_self) + Comment::new(data.clone(), abstract_self) } pub fn CreateEvent(&self, interface: &DOMString) -> Fallible { - match null_str_as_empty_ref(interface) { + match interface.as_slice() { "UIEvents" => Ok(UIEvent::new(self.window, UIEventTypeId)), "MouseEvents" => Ok(MouseEvent::new(self.window)), "HTMLEvents" => Ok(Event::new(self.window, HTMLEventTypeId)), @@ -249,8 +247,7 @@ impl Document { for child in node.children() { if child.is_text() { do child.with_imm_text() |text| { - let s = text.element.Data(); - title = title + null_str_as_empty(&s); + title = title + text.element.Data(); } } } @@ -263,7 +260,7 @@ impl Document { let v: ~[&str] = title.word_iter().collect(); title = v.connect(" "); title = title.trim().to_owned(); - Some(title) + title } pub fn SetTitle(&self, abstract_self: AbstractDocument, title: &DOMString) -> ErrorResult { @@ -307,7 +304,7 @@ impl Document { pub fn GetElementsByName(&self, name: &DOMString) -> @mut HTMLCollection { self.createHTMLCollection(|elem| - elem.get_attr("name").is_some() && eq_slice(elem.get_attr("name").unwrap(), null_str_as_empty(name))) + elem.get_attr("name").is_some() && eq_slice(elem.get_attr("name").unwrap(), *name)) } pub fn createHTMLCollection(&self, callback: &fn(elem: &Element) -> bool) -> @mut HTMLCollection { diff --git a/src/components/script/dom/documenttype.rs b/src/components/script/dom/documenttype.rs index 463ddcfa239..7456ab79330 100644 --- a/src/components/script/dom/documenttype.rs +++ b/src/components/script/dom/documenttype.rs @@ -10,9 +10,9 @@ use dom::node::{AbstractNode, ScriptView, Node, DoctypeNodeTypeId}; /// The `DOCTYPE` tag. pub struct DocumentType { node: Node, - name: ~str, - public_id: Option<~str>, - system_id: Option<~str>, + name: DOMString, + public_id: DOMString, + system_id: DOMString, force_quirks: bool } @@ -26,8 +26,8 @@ impl DocumentType { DocumentType { node: Node::new(DoctypeNodeTypeId, document), name: name, - public_id: public_id, - system_id: system_id, + public_id: public_id.unwrap_or(~""), + system_id: system_id.unwrap_or(~""), force_quirks: force_quirks, } } @@ -48,7 +48,7 @@ impl DocumentType { impl DocumentType { pub fn Name(&self) -> DOMString { - Some(self.name.clone()) + self.name.clone() } pub fn PublicId(&self) -> DOMString { diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index d0baf973bc9..62a668bfdf3 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -154,7 +154,7 @@ impl<'self> Element { } } - pub fn normalize_attr_name(&self, name: &DOMString) -> ~str { + pub fn normalize_attr_name(&self, name: &Option) -> ~str { //FIXME: Throw for XML-invalid names let owner = self.node.owner_doc(); if owner.document().doctype == document::HTML { // && self.namespace == Namespace::HTML @@ -165,7 +165,7 @@ impl<'self> Element { } pub fn get_attribute<'a>(&'a self, - namespace_url: &DOMString, + namespace_url: &Option, name: &str) -> Option<@mut Attr> { let namespace = Namespace::from_str(namespace_url); // FIXME: only case-insensitive in the HTML namespace (as opposed to SVG, etc.) @@ -179,16 +179,16 @@ impl<'self> Element { pub fn set_attr(&mut self, abstract_self: AbstractNode, - raw_name: &DOMString, - raw_value: &DOMString) -> ErrorResult { + raw_name: &Option, + raw_value: &Option) -> ErrorResult { self.set_attribute(abstract_self, namespace::Null, raw_name, raw_value) } pub fn set_attribute(&mut self, abstract_self: AbstractNode, namespace: Namespace, - raw_name: &DOMString, - raw_value: &DOMString) -> ErrorResult { + raw_name: &Option, + raw_value: &Option) -> ErrorResult { //FIXME: Throw for XML-invalid names //FIXME: Throw for XMLNS-invalid names let name = null_str_as_empty(raw_name).to_ascii_lower(); @@ -246,7 +246,7 @@ impl<'self> Element { abstract_self: AbstractNode, namespace: &Namespace, local_name: ~str, - value: &DOMString) { + value: &Option) { if "style" == local_name && *namespace == namespace::Null { self.style_attribute = Some(style::parse_style_attribute( @@ -261,12 +261,12 @@ impl<'self> Element { match abstract_self.type_id() { ElementNodeTypeId(HTMLImageElementTypeId) => { do abstract_self.with_mut_image_element |image| { - image.AfterSetAttr(&Some(local_name.clone()), value); + image.AfterSetAttr(&local_name, &null_str_as_empty(value)); } } ElementNodeTypeId(HTMLIframeElementTypeId) => { do abstract_self.with_mut_iframe_element |iframe| { - iframe.AfterSetAttr(&Some(local_name.clone()), value); + iframe.AfterSetAttr(&local_name, &null_str_as_empty(value)); } } _ => () @@ -281,26 +281,26 @@ impl<'self> Element { impl Element { pub fn TagName(&self) -> DOMString { - Some(self.tag_name.to_owned().to_ascii_upper()) + self.tag_name.to_owned().to_ascii_upper() } pub fn Id(&self, _abstract_self: AbstractNode) -> DOMString { match self.get_attr(&"id") { - Some(x) => Some(x), - None => Some(~"") + Some(x) => x, + None => ~"" } } pub fn SetId(&mut self, abstract_self: AbstractNode, id: &DOMString) { - self.set_attribute(abstract_self, namespace::Null, &Some(~"id"), id); + self.set_attribute(abstract_self, namespace::Null, &Some(~"id"), &Some(id.clone())); } - pub fn GetAttribute(&self, name: &DOMString) -> DOMString { - self.get_attr(null_str_as_empty_ref(name)) + pub fn GetAttribute(&self, name: &DOMString) -> Option { + self.get_attr(*name).map(|s| s.to_owned()) } - pub fn GetAttributeNS(&self, namespace: &DOMString, local_name: &DOMString) -> DOMString { - self.get_attribute(namespace, null_str_as_empty_ref(local_name)) + pub fn GetAttributeNS(&self, namespace: &Option, local_name: &DOMString) -> Option { + self.get_attribute(namespace, *local_name) .map(|attr| attr.value.clone()) } @@ -308,16 +308,16 @@ impl Element { abstract_self: AbstractNode, name: &DOMString, value: &DOMString) -> ErrorResult { - self.set_attr(abstract_self, name, value); + self.set_attr(abstract_self, &Some(name.clone()), &Some(value.clone())); Ok(()) } pub fn SetAttributeNS(&mut self, abstract_self: AbstractNode, - namespace_url: &DOMString, + namespace_url: &Option, name: &DOMString, value: &DOMString) -> ErrorResult { - let name_type = xml_name_type(name.to_str()); + let name_type = xml_name_type(*name); match name_type { InvalidXMLName => return Err(InvalidCharacter), Name => return Err(NamespaceError), @@ -325,14 +325,14 @@ impl Element { } let namespace = Namespace::from_str(namespace_url); - self.set_attribute(abstract_self, namespace, name, value) + self.set_attribute(abstract_self, namespace, &Some(name.clone()), &Some(value.clone())) } pub fn RemoveAttribute(&self, _name: &DOMString) -> ErrorResult { Ok(()) } - pub fn RemoveAttributeNS(&self, _namespace: &DOMString, _localname: &DOMString) -> ErrorResult { + pub fn RemoveAttributeNS(&self, _namespace: &Option, _localname: &DOMString) -> ErrorResult { Ok(()) } @@ -340,7 +340,7 @@ impl Element { self.GetAttribute(name).is_some() } - pub fn HasAttributeNS(&self, namespace: &DOMString, local_name: &DOMString) -> bool { + pub fn HasAttributeNS(&self, namespace: &Option, local_name: &DOMString) -> bool { self.GetAttributeNS(namespace, local_name).is_some() } @@ -348,7 +348,7 @@ impl Element { HTMLCollection::new(self.node.owner_doc().document().window, ~[]) } - pub fn GetElementsByTagNameNS(&self, _namespace: &DOMString, _localname: &DOMString) -> Fallible<@mut HTMLCollection> { + pub fn GetElementsByTagNameNS(&self, _namespace: &Option, _localname: &DOMString) -> Fallible<@mut HTMLCollection> { Ok(HTMLCollection::new(self.node.owner_doc().document().window, ~[])) } @@ -453,7 +453,7 @@ impl Element { } pub fn GetInnerHTML(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn SetInnerHTML(&mut self, _value: &DOMString) -> ErrorResult { @@ -461,7 +461,7 @@ impl Element { } pub fn GetOuterHTML(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn SetOuterHTML(&mut self, _value: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/event.rs b/src/components/script/dom/event.rs index aa70ade8f5c..58d0bad3cff 100644 --- a/src/components/script/dom/event.rs +++ b/src/components/script/dom/event.rs @@ -6,7 +6,7 @@ use dom::eventtarget::AbstractEventTarget; use dom::window::Window; use dom::bindings::codegen::EventBinding; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; -use dom::bindings::utils::{DOMString, ErrorResult, Fallible, null_str_as_word_null}; +use dom::bindings::utils::{DOMString, ErrorResult, Fallible}; use dom::mouseevent::MouseEvent; use dom::uievent::UIEvent; @@ -182,7 +182,7 @@ impl Event { } pub fn Type(&self) -> DOMString { - Some(self.type_.clone()) + self.type_.clone() } pub fn GetTarget(&self) -> Option { @@ -228,7 +228,7 @@ impl Event { type_: &DOMString, bubbles: bool, cancelable: bool) -> ErrorResult { - self.type_ = null_str_as_word_null(type_); + self.type_ = type_.clone(); self.cancelable = cancelable; self.bubbles = bubbles; self.initialized = true; diff --git a/src/components/script/dom/eventtarget.rs b/src/components/script/dom/eventtarget.rs index 77753fd3b5a..92858f93e16 100644 --- a/src/components/script/dom/eventtarget.rs +++ b/src/components/script/dom/eventtarget.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::utils::{Reflectable, Reflector, DOMString, Fallible}; -use dom::bindings::utils::{null_str_as_word_null, InvalidState}; +use dom::bindings::utils::{InvalidState}; use dom::bindings::codegen::EventListenerBinding::EventListener; use dom::document::AbstractDocument; use dom::event::AbstractEvent; @@ -145,7 +145,7 @@ impl EventTarget { listener: Option, capture: bool) { for &listener in listener.iter() { - let entry = self.handlers.find_or_insert_with(null_str_as_word_null(ty), |_| ~[]); + let entry = self.handlers.find_or_insert_with(ty.clone(), |_| ~[]); let phase = if capture { Capturing } else { Bubbling }; let new_entry = EventListenerEntry { phase: phase, @@ -162,7 +162,7 @@ impl EventTarget { listener: Option, capture: bool) { for &listener in listener.iter() { - let mut entry = self.handlers.find_mut(&null_str_as_word_null(ty)); + let mut entry = self.handlers.find_mut(ty); for entry in entry.mut_iter() { let phase = if capture { Capturing } else { Bubbling }; let old_entry = EventListenerEntry { diff --git a/src/components/script/dom/formdata.rs b/src/components/script/dom/formdata.rs index de34386bcac..1a0a760f505 100644 --- a/src/components/script/dom/formdata.rs +++ b/src/components/script/dom/formdata.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; -use dom::bindings::utils::{DOMString, null_str_as_empty}; +use dom::bindings::utils::DOMString; use dom::bindings::codegen::FormDataBinding; use dom::blob::Blob; use dom::window::Window; @@ -37,13 +37,13 @@ impl FormData { pub fn Append(&mut self, name: &DOMString, value: @mut Blob, filename: Option) { let blob = BlobData { blob: value, - name: filename.unwrap_or(Some(~"default")) + name: filename.unwrap_or(~"default") }; - self.data.insert(null_str_as_empty(name), blob); + self.data.insert(name.clone(), blob); } pub fn Append_(&mut self, name: &DOMString, value: &DOMString) { - self.data.insert(null_str_as_empty(name), StringData((*value).clone())); + self.data.insert(name.clone(), StringData((*value).clone())); } } diff --git a/src/components/script/dom/htmlanchorelement.rs b/src/components/script/dom/htmlanchorelement.rs index 21a28aecaeb..53310c7b336 100644 --- a/src/components/script/dom/htmlanchorelement.rs +++ b/src/components/script/dom/htmlanchorelement.rs @@ -28,7 +28,7 @@ impl HTMLAnchorElement { impl HTMLAnchorElement { pub fn Href(&self) -> DOMString { - None + ~"" } pub fn SetHref(&mut self, _href: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLAnchorElement { } pub fn Target(&self) -> DOMString { - None + ~"" } pub fn SetTarget(&self, _target: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLAnchorElement { } pub fn Download(&self) -> DOMString { - None + ~"" } pub fn SetDownload(&self, _download: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLAnchorElement { } pub fn Ping(&self) -> DOMString { - None + ~"" } pub fn SetPing(&self, _ping: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLAnchorElement { } pub fn Rel(&self) -> DOMString { - None + ~"" } pub fn SetRel(&self, _rel: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLAnchorElement { } pub fn Hreflang(&self) -> DOMString { - None + ~"" } pub fn SetHreflang(&self, _href_lang: &DOMString) -> ErrorResult { @@ -76,7 +76,7 @@ impl HTMLAnchorElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -84,7 +84,7 @@ impl HTMLAnchorElement { } pub fn Text(&self) -> DOMString { - None + ~"" } pub fn SetText(&mut self, _text: &DOMString) -> ErrorResult { @@ -92,7 +92,7 @@ impl HTMLAnchorElement { } pub fn Coords(&self) -> DOMString { - None + ~"" } pub fn SetCoords(&mut self, _coords: &DOMString) -> ErrorResult { @@ -100,7 +100,7 @@ impl HTMLAnchorElement { } pub fn Charset(&self) -> DOMString { - None + ~"" } pub fn SetCharset(&mut self, _charset: &DOMString) -> ErrorResult { @@ -108,7 +108,7 @@ impl HTMLAnchorElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -116,7 +116,7 @@ impl HTMLAnchorElement { } pub fn Rev(&self) -> DOMString { - None + ~"" } pub fn SetRev(&mut self, _rev: &DOMString) -> ErrorResult { @@ -124,7 +124,7 @@ impl HTMLAnchorElement { } pub fn Shape(&self) -> DOMString { - None + ~"" } pub fn SetShape(&mut self, _shape: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlappletelement.rs b/src/components/script/dom/htmlappletelement.rs index 7471c3557d6..bc61d7b48eb 100644 --- a/src/components/script/dom/htmlappletelement.rs +++ b/src/components/script/dom/htmlappletelement.rs @@ -28,7 +28,7 @@ impl HTMLAppletElement { impl HTMLAppletElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLAppletElement { } pub fn Alt(&self) -> DOMString { - None + ~"" } pub fn SetAlt(&self, _alt: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLAppletElement { } pub fn Archive(&self) -> DOMString { - None + ~"" } pub fn SetArchive(&self, _archive: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLAppletElement { } pub fn Code(&self) -> DOMString { - None + ~"" } pub fn SetCode(&self, _code: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLAppletElement { } pub fn CodeBase(&self) -> DOMString { - None + ~"" } pub fn SetCodeBase(&self, _code_base: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLAppletElement { } pub fn Height(&self) -> DOMString { - None + ~"" } pub fn SetHeight(&self, _height: &DOMString) -> ErrorResult { @@ -84,7 +84,7 @@ impl HTMLAppletElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -92,7 +92,7 @@ impl HTMLAppletElement { } pub fn Object(&self) -> DOMString { - None + ~"" } pub fn SetObject(&mut self, _object: &DOMString) -> ErrorResult { @@ -108,7 +108,7 @@ impl HTMLAppletElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&mut self, _width: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlareaelement.rs b/src/components/script/dom/htmlareaelement.rs index 4f77f9a12ed..7f786c1e461 100644 --- a/src/components/script/dom/htmlareaelement.rs +++ b/src/components/script/dom/htmlareaelement.rs @@ -28,7 +28,7 @@ impl HTMLAreaElement { impl HTMLAreaElement { pub fn Alt(&self) -> DOMString { - None + ~"" } pub fn SetAlt(&self, _alt: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLAreaElement { } pub fn Coords(&self) -> DOMString { - None + ~"" } pub fn SetCoords(&self, _coords: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLAreaElement { } pub fn Shape(&self) -> DOMString { - None + ~"" } pub fn SetShape(&self, _shape: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLAreaElement { } pub fn Href(&self) -> DOMString { - None + ~"" } pub fn SetHref(&self, _href: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLAreaElement { } pub fn Target(&self) -> DOMString { - None + ~"" } pub fn SetTarget(&self, _target: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLAreaElement { } pub fn Download(&self) -> DOMString { - None + ~"" } pub fn SetDownload(&self, _download: &DOMString) -> ErrorResult { @@ -76,7 +76,7 @@ impl HTMLAreaElement { } pub fn Ping(&self) -> DOMString { - None + ~"" } pub fn SetPing(&self, _ping: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlbaseelement.rs b/src/components/script/dom/htmlbaseelement.rs index 077db6d8405..4ea0dbe457b 100644 --- a/src/components/script/dom/htmlbaseelement.rs +++ b/src/components/script/dom/htmlbaseelement.rs @@ -28,7 +28,7 @@ impl HTMLBaseElement { impl HTMLBaseElement { pub fn Href(&self) -> DOMString { - None + ~"" } pub fn SetHref(&self, _href: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLBaseElement { } pub fn Target(&self) -> DOMString { - None + ~"" } pub fn SetTarget(&self, _target: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlbodyelement.rs b/src/components/script/dom/htmlbodyelement.rs index 4105c0742ad..05468113282 100644 --- a/src/components/script/dom/htmlbodyelement.rs +++ b/src/components/script/dom/htmlbodyelement.rs @@ -28,7 +28,7 @@ impl HTMLBodyElement { impl HTMLBodyElement { pub fn Text(&self) -> DOMString { - None + ~"" } pub fn SetText(&mut self, _text: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLBodyElement { } pub fn Link(&self) -> DOMString { - None + ~"" } pub fn SetLink(&self, _link: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLBodyElement { } pub fn VLink(&self) -> DOMString { - None + ~"" } pub fn SetVLink(&self, _v_link: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLBodyElement { } pub fn ALink(&self) -> DOMString { - None + ~"" } pub fn SetALink(&self, _a_link: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLBodyElement { } pub fn BgColor(&self) -> DOMString { - None + ~"" } pub fn SetBgColor(&self, _bg_color: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLBodyElement { } pub fn Background(&self) -> DOMString { - None + ~"" } pub fn SetBackground(&self, _background: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlbrelement.rs b/src/components/script/dom/htmlbrelement.rs index 653424c1c8c..49ee1afddc0 100644 --- a/src/components/script/dom/htmlbrelement.rs +++ b/src/components/script/dom/htmlbrelement.rs @@ -28,7 +28,7 @@ impl HTMLBRElement { impl HTMLBRElement { pub fn Clear(&self) -> DOMString { - None + ~"" } pub fn SetClear(&mut self, _text: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlbuttonelement.rs b/src/components/script/dom/htmlbuttonelement.rs index 5bd1c352d8e..b57d51bd2ed 100644 --- a/src/components/script/dom/htmlbuttonelement.rs +++ b/src/components/script/dom/htmlbuttonelement.rs @@ -49,7 +49,7 @@ impl HTMLButtonElement { } pub fn FormAction(&self) -> DOMString { - None + ~"" } pub fn SetFormAction(&mut self, _formaction: &DOMString) -> ErrorResult { @@ -57,7 +57,7 @@ impl HTMLButtonElement { } pub fn FormEnctype(&self) -> DOMString { - None + ~"" } pub fn SetFormEnctype(&mut self, _formenctype: &DOMString) -> ErrorResult { @@ -65,7 +65,7 @@ impl HTMLButtonElement { } pub fn FormMethod(&self) -> DOMString { - None + ~"" } pub fn SetFormMethod(&mut self, _formmethod: &DOMString) -> ErrorResult { @@ -81,7 +81,7 @@ impl HTMLButtonElement { } pub fn FormTarget(&self) -> DOMString { - None + ~"" } pub fn SetFormTarget(&mut self, _formtarget: &DOMString) -> ErrorResult { @@ -89,7 +89,7 @@ impl HTMLButtonElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -97,7 +97,7 @@ impl HTMLButtonElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -105,7 +105,7 @@ impl HTMLButtonElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) -> ErrorResult { @@ -128,7 +128,7 @@ impl HTMLButtonElement { } pub fn ValidationMessage(&self) -> DOMString { - None + ~"" } pub fn SetValidationMessage(&mut self, _message: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlcollection.rs b/src/components/script/dom/htmlcollection.rs index 03a5ebac878..c54606ba108 100644 --- a/src/components/script/dom/htmlcollection.rs +++ b/src/components/script/dom/htmlcollection.rs @@ -55,7 +55,7 @@ impl HTMLCollection { self.Item(index) } - pub fn NamedGetter(&self, _cx: *JSContext, _name: &DOMString, _found: &mut bool) -> Fallible<*JSObject> { + pub fn NamedGetter(&self, _cx: *JSContext, _name: &Option, _found: &mut bool) -> Fallible<*JSObject> { Ok(ptr::null()) } } diff --git a/src/components/script/dom/htmldataelement.rs b/src/components/script/dom/htmldataelement.rs index 5e97f113cbf..609cae1029e 100644 --- a/src/components/script/dom/htmldataelement.rs +++ b/src/components/script/dom/htmldataelement.rs @@ -28,7 +28,7 @@ impl HTMLDataElement { impl HTMLDataElement { pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmldivelement.rs b/src/components/script/dom/htmldivelement.rs index 26ce3ba6a14..62811cf7a3c 100644 --- a/src/components/script/dom/htmldivelement.rs +++ b/src/components/script/dom/htmldivelement.rs @@ -28,7 +28,7 @@ impl HTMLDivElement { impl HTMLDivElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmldlistelement.rs b/src/components/script/dom/htmldlistelement.rs index 63b770e9534..ce7ceca98de 100644 --- a/src/components/script/dom/htmldlistelement.rs +++ b/src/components/script/dom/htmldlistelement.rs @@ -36,7 +36,7 @@ impl HTMLDListElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlelement.rs b/src/components/script/dom/htmlelement.rs index b7ff82b6e6d..a5291e5b575 100644 --- a/src/components/script/dom/htmlelement.rs +++ b/src/components/script/dom/htmlelement.rs @@ -29,21 +29,21 @@ impl HTMLElement { impl HTMLElement { pub fn Title(&self) -> DOMString { - None + ~"" } pub fn SetTitle(&mut self, _title: &DOMString) { } pub fn Lang(&self) -> DOMString { - None + ~"" } pub fn SetLang(&mut self, _lang: &DOMString) { } pub fn Dir(&self) -> DOMString { - None + ~"" } pub fn SetDir(&mut self, _dir: &DOMString) -> ErrorResult { @@ -86,7 +86,7 @@ impl HTMLElement { } pub fn AccessKey(&self) -> DOMString { - None + ~"" } pub fn SetAccessKey(&self, _key: &DOMString) -> ErrorResult { @@ -94,7 +94,7 @@ impl HTMLElement { } pub fn AccessKeyLabel(&self) -> DOMString { - None + ~"" } pub fn Draggable(&self) -> bool { @@ -106,7 +106,7 @@ impl HTMLElement { } pub fn ContentEditable(&self) -> DOMString { - None + ~"" } pub fn SetContentEditable(&mut self, _val: &DOMString) -> ErrorResult { @@ -126,7 +126,7 @@ impl HTMLElement { } pub fn ClassName(&self) -> DOMString { - None + ~"" } pub fn SetClassName(&self, _class: &DOMString) { diff --git a/src/components/script/dom/htmlembedelement.rs b/src/components/script/dom/htmlembedelement.rs index ca9b0e5a53e..747d5f218f7 100644 --- a/src/components/script/dom/htmlembedelement.rs +++ b/src/components/script/dom/htmlembedelement.rs @@ -28,7 +28,7 @@ impl HTMLEmbedElement { impl HTMLEmbedElement { pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLEmbedElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLEmbedElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&mut self, _width: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLEmbedElement { } pub fn Height(&self) -> DOMString { - None + ~"" } pub fn SetHeight(&mut self, _height: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLEmbedElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _type: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLEmbedElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlfieldsetelement.rs b/src/components/script/dom/htmlfieldsetelement.rs index 89011d9dfda..d5c1fc659c0 100644 --- a/src/components/script/dom/htmlfieldsetelement.rs +++ b/src/components/script/dom/htmlfieldsetelement.rs @@ -42,7 +42,7 @@ impl HTMLFieldSetElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -50,7 +50,7 @@ impl HTMLFieldSetElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn Elements(&self) -> @mut HTMLCollection { @@ -68,7 +68,7 @@ impl HTMLFieldSetElement { } pub fn ValidationMessage(&self) -> DOMString { - None + ~"" } pub fn CheckValidity(&self) -> bool { diff --git a/src/components/script/dom/htmlfontelement.rs b/src/components/script/dom/htmlfontelement.rs index d15251e4c7d..43b60973dcb 100644 --- a/src/components/script/dom/htmlfontelement.rs +++ b/src/components/script/dom/htmlfontelement.rs @@ -28,7 +28,7 @@ impl HTMLFontElement { impl HTMLFontElement { pub fn Color(&self) -> DOMString { - None + ~"" } pub fn SetColor(&mut self, _color: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLFontElement { } pub fn Face(&self) -> DOMString { - None + ~"" } pub fn SetFace(&mut self, _face: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLFontElement { } pub fn Size(&self) -> DOMString { - None + ~"" } pub fn SetSize(&mut self, _size: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlformelement.rs b/src/components/script/dom/htmlformelement.rs index 54469a9631f..ff207ae4535 100644 --- a/src/components/script/dom/htmlformelement.rs +++ b/src/components/script/dom/htmlformelement.rs @@ -29,7 +29,7 @@ impl HTMLFormElement { impl HTMLFormElement { pub fn AcceptCharset(&self) -> DOMString { - None + ~"" } pub fn SetAcceptCharset(&mut self, _accept_charset: &DOMString) -> ErrorResult { @@ -37,7 +37,7 @@ impl HTMLFormElement { } pub fn Action(&self) -> DOMString { - None + ~"" } pub fn SetAction(&mut self, _action: &DOMString) -> ErrorResult { @@ -45,7 +45,7 @@ impl HTMLFormElement { } pub fn Autocomplete(&self) -> DOMString { - None + ~"" } pub fn SetAutocomplete(&mut self, _autocomplete: &DOMString) -> ErrorResult { @@ -53,7 +53,7 @@ impl HTMLFormElement { } pub fn Enctype(&self) -> DOMString { - None + ~"" } pub fn SetEnctype(&mut self, _enctype: &DOMString) -> ErrorResult { @@ -61,7 +61,7 @@ impl HTMLFormElement { } pub fn Encoding(&self) -> DOMString { - None + ~"" } pub fn SetEncoding(&mut self, _encoding: &DOMString) -> ErrorResult { @@ -69,7 +69,7 @@ impl HTMLFormElement { } pub fn Method(&self) -> DOMString { - None + ~"" } pub fn SetMethod(&mut self, _method: &DOMString) -> ErrorResult { @@ -77,7 +77,7 @@ impl HTMLFormElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -93,7 +93,7 @@ impl HTMLFormElement { } pub fn Target(&self) -> DOMString { - None + ~"" } pub fn SetTarget(&mut self, _target: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlframeelement.rs b/src/components/script/dom/htmlframeelement.rs index a9ab387c58e..8ccefd328ce 100644 --- a/src/components/script/dom/htmlframeelement.rs +++ b/src/components/script/dom/htmlframeelement.rs @@ -29,7 +29,7 @@ impl HTMLFrameElement { impl HTMLFrameElement { pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -37,7 +37,7 @@ impl HTMLFrameElement { } pub fn Scrolling(&self) -> DOMString { - None + ~"" } pub fn SetScrolling(&mut self, _scrolling: &DOMString) -> ErrorResult { @@ -45,7 +45,7 @@ impl HTMLFrameElement { } pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -53,7 +53,7 @@ impl HTMLFrameElement { } pub fn FrameBorder(&self) -> DOMString { - None + ~"" } pub fn SetFrameBorder(&mut self, _frameborder: &DOMString) -> ErrorResult { @@ -61,7 +61,7 @@ impl HTMLFrameElement { } pub fn LongDesc(&self) -> DOMString { - None + ~"" } pub fn SetLongDesc(&mut self, _longdesc: &DOMString) -> ErrorResult { @@ -85,7 +85,7 @@ impl HTMLFrameElement { } pub fn MarginHeight(&self) -> DOMString { - None + ~"" } pub fn SetMarginHeight(&mut self, _height: &DOMString) -> ErrorResult { @@ -93,7 +93,7 @@ impl HTMLFrameElement { } pub fn MarginWidth(&self) -> DOMString { - None + ~"" } pub fn SetMarginWidth(&mut self, _height: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlframesetelement.rs b/src/components/script/dom/htmlframesetelement.rs index 42dc12f78e4..f5d9404654c 100644 --- a/src/components/script/dom/htmlframesetelement.rs +++ b/src/components/script/dom/htmlframesetelement.rs @@ -28,7 +28,7 @@ impl HTMLFrameSetElement { impl HTMLFrameSetElement { pub fn Cols(&self) -> DOMString { - None + ~"" } pub fn SetCols(&mut self, _cols: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLFrameSetElement { } pub fn Rows(&self) -> DOMString { - None + ~"" } pub fn SetRows(&mut self, _rows: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlheadingelement.rs b/src/components/script/dom/htmlheadingelement.rs index a8b840b6edc..cce5eaf11ea 100644 --- a/src/components/script/dom/htmlheadingelement.rs +++ b/src/components/script/dom/htmlheadingelement.rs @@ -39,7 +39,7 @@ impl HTMLHeadingElement { impl HTMLHeadingElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) { diff --git a/src/components/script/dom/htmlhrelement.rs b/src/components/script/dom/htmlhrelement.rs index cb7662148c1..40be15ef330 100644 --- a/src/components/script/dom/htmlhrelement.rs +++ b/src/components/script/dom/htmlhrelement.rs @@ -28,7 +28,7 @@ impl HTMLHRElement { impl HTMLHRElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLHRElement { } pub fn Color(&self) -> DOMString { - None + ~"" } pub fn SetColor(&mut self, _color: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLHRElement { } pub fn Size(&self) -> DOMString { - None + ~"" } pub fn SetSize(&mut self, _size: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLHRElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&mut self, _width: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlhtmlelement.rs b/src/components/script/dom/htmlhtmlelement.rs index 1292ff49692..31b4e0f99de 100644 --- a/src/components/script/dom/htmlhtmlelement.rs +++ b/src/components/script/dom/htmlhtmlelement.rs @@ -28,7 +28,7 @@ impl HTMLHtmlElement { impl HTMLHtmlElement { pub fn Version(&self) -> DOMString { - None + ~"" } pub fn SetVersion(&mut self, _version: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmliframeelement.rs b/src/components/script/dom/htmliframeelement.rs index 08bde32f44e..f0bc904e54a 100644 --- a/src/components/script/dom/htmliframeelement.rs +++ b/src/components/script/dom/htmliframeelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::HTMLIFrameElementBinding; -use dom::bindings::utils::{DOMString, ErrorResult, null_str_as_empty}; +use dom::bindings::utils::{DOMString, ErrorResult}; use dom::document::AbstractDocument; use dom::element::HTMLIframeElementTypeId; use dom::htmlelement::HTMLElement; @@ -78,7 +78,7 @@ impl HTMLIFrameElement { impl HTMLIFrameElement { pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -86,7 +86,7 @@ impl HTMLIFrameElement { } pub fn Srcdoc(&self) -> DOMString { - None + ~"" } pub fn SetSrcdoc(&mut self, _srcdoc: &DOMString) -> ErrorResult { @@ -94,7 +94,7 @@ impl HTMLIFrameElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -102,19 +102,20 @@ impl HTMLIFrameElement { } pub fn Sandbox(&self, _abstract_self: AbstractNode) -> DOMString { - self.htmlelement.element.GetAttribute(&Some(~"sandbox")) + match self.htmlelement.element.GetAttribute(&~"sandbox") { + Some(s) => s.to_owned(), + None => ~"", + } } pub fn SetSandbox(&mut self, abstract_self: AbstractNode, sandbox: &DOMString) { - self.htmlelement.element.SetAttribute(abstract_self, &Some(~"sandbox"), sandbox); + self.htmlelement.element.SetAttribute(abstract_self, &~"sandbox", sandbox); } pub fn AfterSetAttr(&mut self, name: &DOMString, value: &DOMString) { - let name = null_str_as_empty(name); - if "sandbox" == name { + if "sandbox" == *name { let mut modes = AllowNothing as u8; - let words = null_str_as_empty(value); - for word in words.split_iter(' ') { + for word in value.split_iter(' ') { modes |= match word.to_ascii_lower().as_slice() { "allow-same-origin" => AllowSameOrigin, "allow-forms" => AllowForms, @@ -138,7 +139,7 @@ impl HTMLIFrameElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&mut self, _width: &DOMString) -> ErrorResult { @@ -146,7 +147,7 @@ impl HTMLIFrameElement { } pub fn Height(&self) -> DOMString { - None + ~"" } pub fn SetHeight(&mut self, _height: &DOMString) -> ErrorResult { @@ -162,7 +163,7 @@ impl HTMLIFrameElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -170,7 +171,7 @@ impl HTMLIFrameElement { } pub fn Scrolling(&self) -> DOMString { - None + ~"" } pub fn SetScrolling(&mut self, _scrolling: &DOMString) -> ErrorResult { @@ -178,7 +179,7 @@ impl HTMLIFrameElement { } pub fn FrameBorder(&self) -> DOMString { - None + ~"" } pub fn SetFrameBorder(&mut self, _frameborder: &DOMString) -> ErrorResult { @@ -186,7 +187,7 @@ impl HTMLIFrameElement { } pub fn LongDesc(&self) -> DOMString { - None + ~"" } pub fn SetLongDesc(&mut self, _longdesc: &DOMString) -> ErrorResult { @@ -194,7 +195,7 @@ impl HTMLIFrameElement { } pub fn MarginHeight(&self) -> DOMString { - None + ~"" } pub fn SetMarginHeight(&mut self, _marginheight: &DOMString) -> ErrorResult { @@ -202,7 +203,7 @@ impl HTMLIFrameElement { } pub fn MarginWidth(&self) -> DOMString { - None + ~"" } pub fn SetMarginWidth(&mut self, _marginwidth: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlimageelement.rs b/src/components/script/dom/htmlimageelement.rs index 94b48b6252f..ea5aeabc541 100644 --- a/src/components/script/dom/htmlimageelement.rs +++ b/src/components/script/dom/htmlimageelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::HTMLImageElementBinding; -use dom::bindings::utils::{DOMString, ErrorResult, null_str_as_empty}; +use dom::bindings::utils::{DOMString, ErrorResult}; use dom::document::AbstractDocument; use dom::element::HTMLImageElementTypeId; use dom::htmlelement::HTMLElement; @@ -58,8 +58,7 @@ impl HTMLImageElement { } pub fn AfterSetAttr(&mut self, name: &DOMString, _value: &DOMString) { - let name = null_str_as_empty(name); - if "src" == name { + if "src" == *name { let document = self.htmlelement.element.node.owner_doc(); let window = document.document().window; let url = window.page.url.as_ref().map(|&(ref url, _)| url.clone()); @@ -68,7 +67,7 @@ impl HTMLImageElement { } pub fn Alt(&self) -> DOMString { - None + ~"" } pub fn SetAlt(&mut self, _alt: &DOMString) -> ErrorResult { @@ -76,7 +75,7 @@ impl HTMLImageElement { } pub fn Src(&self, _abstract_self: AbstractNode) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, @@ -85,12 +84,12 @@ impl HTMLImageElement { let node = &mut self.htmlelement.element; node.set_attr(abstract_self, &Some(~"src"), - &Some(null_str_as_empty(src))); + &Some(src.clone())); Ok(()) } pub fn CrossOrigin(&self) -> DOMString { - None + ~"" } pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString) -> ErrorResult { @@ -98,7 +97,7 @@ impl HTMLImageElement { } pub fn UseMap(&self) -> DOMString { - None + ~"" } pub fn SetUseMap(&mut self, _use_map: &DOMString) -> ErrorResult { @@ -168,7 +167,7 @@ impl HTMLImageElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -176,7 +175,7 @@ impl HTMLImageElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -200,7 +199,7 @@ impl HTMLImageElement { } pub fn LongDesc(&self) -> DOMString { - None + ~"" } pub fn SetLongDesc(&mut self, _longdesc: &DOMString) -> ErrorResult { @@ -208,7 +207,7 @@ impl HTMLImageElement { } pub fn Border(&self) -> DOMString { - None + ~"" } pub fn SetBorder(&mut self, _border: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlinputelement.rs b/src/components/script/dom/htmlinputelement.rs index 5e85f32dc79..59ec882568a 100644 --- a/src/components/script/dom/htmlinputelement.rs +++ b/src/components/script/dom/htmlinputelement.rs @@ -28,7 +28,7 @@ impl HTMLInputElement { impl HTMLInputElement { pub fn Accept(&self) -> DOMString { - None + ~"" } pub fn SetAccept(&mut self, _accept: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLInputElement { } pub fn Alt(&self) -> DOMString { - None + ~"" } pub fn SetAlt(&mut self, _alt: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLInputElement { } pub fn Autocomplete(&self) -> DOMString { - None + ~"" } pub fn SetAutocomplete(&mut self, _autocomple: &DOMString) -> ErrorResult { @@ -83,7 +83,7 @@ impl HTMLInputElement { } pub fn FormAction(&self) -> DOMString { - None + ~"" } pub fn SetFormAction(&mut self, _form_action: &DOMString) -> ErrorResult { @@ -91,7 +91,7 @@ impl HTMLInputElement { } pub fn FormEnctype(&self) -> DOMString { - None + ~"" } pub fn SetFormEnctype(&mut self, _form_enctype: &DOMString) -> ErrorResult { @@ -99,7 +99,7 @@ impl HTMLInputElement { } pub fn FormMethod(&self) -> DOMString { - None + ~"" } pub fn SetFormMethod(&mut self, _form_method: &DOMString) -> ErrorResult { @@ -115,7 +115,7 @@ impl HTMLInputElement { } pub fn FormTarget(&self) -> DOMString { - None + ~"" } pub fn SetFormTarget(&mut self, _form_target: &DOMString) -> ErrorResult { @@ -138,7 +138,7 @@ impl HTMLInputElement { } pub fn InputMode(&self) -> DOMString { - None + ~"" } pub fn SetInputMode(&mut self, _input_mode: &DOMString) -> ErrorResult { @@ -146,7 +146,7 @@ impl HTMLInputElement { } pub fn Max(&self) -> DOMString { - None + ~"" } pub fn SetMax(&mut self, _max: &DOMString) -> ErrorResult { @@ -162,7 +162,7 @@ impl HTMLInputElement { } pub fn Min(&self) -> DOMString { - None + ~"" } pub fn SetMin(&mut self, _min: &DOMString) -> ErrorResult { @@ -178,7 +178,7 @@ impl HTMLInputElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -186,7 +186,7 @@ impl HTMLInputElement { } pub fn Pattern(&self) -> DOMString { - None + ~"" } pub fn SetPattern(&mut self, _pattern: &DOMString) -> ErrorResult { @@ -194,7 +194,7 @@ impl HTMLInputElement { } pub fn Placeholder(&self) -> DOMString { - None + ~"" } pub fn SetPlaceholder(&mut self, _placeholder: &DOMString) -> ErrorResult { @@ -226,7 +226,7 @@ impl HTMLInputElement { } pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -234,7 +234,7 @@ impl HTMLInputElement { } pub fn Step(&self) -> DOMString { - None + ~"" } pub fn SetStep(&mut self, _step: &DOMString) -> ErrorResult { @@ -242,7 +242,7 @@ impl HTMLInputElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -250,7 +250,7 @@ impl HTMLInputElement { } pub fn DefaultValue(&self) -> DOMString { - None + ~"" } pub fn SetDefaultValue(&mut self, _default_value: &DOMString) -> ErrorResult { @@ -258,7 +258,7 @@ impl HTMLInputElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) -> ErrorResult { @@ -280,7 +280,7 @@ impl HTMLInputElement { } pub fn GetValidationMessage(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn CheckValidity(&self) -> bool { @@ -310,7 +310,7 @@ impl HTMLInputElement { } pub fn GetSelectionDirection(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn SetSelectionDirection(&mut self, _selection_direction: &DOMString) -> ErrorResult { @@ -318,7 +318,7 @@ impl HTMLInputElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -326,7 +326,7 @@ impl HTMLInputElement { } pub fn UseMap(&self) -> DOMString { - None + ~"" } pub fn SetUseMap(&mut self, _align: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmllabelelement.rs b/src/components/script/dom/htmllabelelement.rs index 35ffbfa900e..68c07e78c97 100644 --- a/src/components/script/dom/htmllabelelement.rs +++ b/src/components/script/dom/htmllabelelement.rs @@ -28,7 +28,7 @@ impl HTMLLabelElement { impl HTMLLabelElement { pub fn HtmlFor(&self) -> DOMString { - None + ~"" } pub fn SetHtmlFor(&mut self, _html_for: &DOMString) { diff --git a/src/components/script/dom/htmllegendelement.rs b/src/components/script/dom/htmllegendelement.rs index 2eeec359a44..ab6fdf47d25 100644 --- a/src/components/script/dom/htmllegendelement.rs +++ b/src/components/script/dom/htmllegendelement.rs @@ -28,7 +28,7 @@ impl HTMLLegendElement { impl HTMLLegendElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmllielement.rs b/src/components/script/dom/htmllielement.rs index ea719be1362..025db42d4a7 100644 --- a/src/components/script/dom/htmllielement.rs +++ b/src/components/script/dom/htmllielement.rs @@ -36,7 +36,7 @@ impl HTMLLIElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmllinkelement.rs b/src/components/script/dom/htmllinkelement.rs index 6833e457ba4..de8cef23169 100644 --- a/src/components/script/dom/htmllinkelement.rs +++ b/src/components/script/dom/htmllinkelement.rs @@ -35,7 +35,7 @@ impl HTMLLinkElement { } pub fn Href(&self) -> DOMString { - None + ~"" } pub fn SetHref(&mut self, _href: &DOMString) -> ErrorResult { @@ -43,7 +43,7 @@ impl HTMLLinkElement { } pub fn CrossOrigin(&self) -> DOMString { - None + ~"" } pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString) -> ErrorResult { @@ -51,7 +51,7 @@ impl HTMLLinkElement { } pub fn Rel(&self) -> DOMString { - None + ~"" } pub fn SetRel(&mut self, _rel: &DOMString) -> ErrorResult { @@ -59,7 +59,7 @@ impl HTMLLinkElement { } pub fn Media(&self) -> DOMString { - None + ~"" } pub fn SetMedia(&mut self, _media: &DOMString) -> ErrorResult { @@ -67,7 +67,7 @@ impl HTMLLinkElement { } pub fn Hreflang(&self) -> DOMString { - None + ~"" } pub fn SetHreflang(&mut self, _href: &DOMString) -> ErrorResult { @@ -75,7 +75,7 @@ impl HTMLLinkElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -83,7 +83,7 @@ impl HTMLLinkElement { } pub fn Charset(&self) -> DOMString { - None + ~"" } pub fn SetCharset(&mut self, _charset: &DOMString) -> ErrorResult { @@ -91,7 +91,7 @@ impl HTMLLinkElement { } pub fn Rev(&self) -> DOMString { - None + ~"" } pub fn SetRev(&mut self, _rev: &DOMString) -> ErrorResult { @@ -99,7 +99,7 @@ impl HTMLLinkElement { } pub fn Target(&self) -> DOMString { - None + ~"" } pub fn SetTarget(&mut self, _target: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlmapelement.rs b/src/components/script/dom/htmlmapelement.rs index 7174f829c31..20ad9fc1b41 100644 --- a/src/components/script/dom/htmlmapelement.rs +++ b/src/components/script/dom/htmlmapelement.rs @@ -29,7 +29,7 @@ impl HTMLMapElement { impl HTMLMapElement { pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlmediaelement.rs b/src/components/script/dom/htmlmediaelement.rs index 1daad8ecf95..40f6632af46 100644 --- a/src/components/script/dom/htmlmediaelement.rs +++ b/src/components/script/dom/htmlmediaelement.rs @@ -21,7 +21,7 @@ impl HTMLMediaElement { impl HTMLMediaElement { pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -29,11 +29,11 @@ impl HTMLMediaElement { } pub fn CurrentSrc(&self) -> DOMString { - None + ~"" } pub fn CrossOrigin(&self) -> DOMString { - None + ~"" } pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString) -> ErrorResult { @@ -41,7 +41,7 @@ impl HTMLMediaElement { } pub fn Preload(&self) -> DOMString { - None + ~"" } pub fn SetPreload(&mut self, _preload: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLMediaElement { } pub fn CanPlayType(&self, _type: &DOMString) -> DOMString { - None + ~"" } pub fn ReadyState(&self) -> u16 { diff --git a/src/components/script/dom/htmlmetaelement.rs b/src/components/script/dom/htmlmetaelement.rs index 20a6257e74b..45aa5c78bcd 100644 --- a/src/components/script/dom/htmlmetaelement.rs +++ b/src/components/script/dom/htmlmetaelement.rs @@ -28,7 +28,7 @@ impl HTMLMetaElement { impl HTMLMetaElement { pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLMetaElement { } pub fn HttpEquiv(&self) -> DOMString { - None + ~"" } pub fn SetHttpEquiv(&mut self, _http_equiv: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLMetaElement { } pub fn Content(&self) -> DOMString { - None + ~"" } pub fn SetContent(&mut self, _content: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLMetaElement { } pub fn Scheme(&self) -> DOMString { - None + ~"" } pub fn SetScheme(&mut self, _scheme: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlmodelement.rs b/src/components/script/dom/htmlmodelement.rs index ff45b90be87..3414f6f17f2 100644 --- a/src/components/script/dom/htmlmodelement.rs +++ b/src/components/script/dom/htmlmodelement.rs @@ -28,7 +28,7 @@ impl HTMLModElement { impl HTMLModElement { pub fn Cite(&self) -> DOMString { - None + ~"" } pub fn SetCite(&mut self, _cite: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLModElement { } pub fn DateTime(&self) -> DOMString { - None + ~"" } pub fn SetDateTime(&mut self, _datetime: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlobjectelement.rs b/src/components/script/dom/htmlobjectelement.rs index 7fc29c32812..ce73cb0c830 100644 --- a/src/components/script/dom/htmlobjectelement.rs +++ b/src/components/script/dom/htmlobjectelement.rs @@ -30,7 +30,7 @@ impl HTMLObjectElement { impl HTMLObjectElement { pub fn Data(&self) -> DOMString { - None + ~"" } pub fn SetData(&mut self, _data: &DOMString) -> ErrorResult { @@ -38,7 +38,7 @@ impl HTMLObjectElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -46,7 +46,7 @@ impl HTMLObjectElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -54,7 +54,7 @@ impl HTMLObjectElement { } pub fn UseMap(&self) -> DOMString { - None + ~"" } pub fn SetUseMap(&mut self, _use_map: &DOMString) -> ErrorResult { @@ -66,7 +66,7 @@ impl HTMLObjectElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&mut self, _width: &DOMString) -> ErrorResult { @@ -74,7 +74,7 @@ impl HTMLObjectElement { } pub fn Height(&self) -> DOMString { - None + ~"" } pub fn SetHeight(&mut self, _height: &DOMString) -> ErrorResult { @@ -99,7 +99,7 @@ impl HTMLObjectElement { } pub fn ValidationMessage(&self) -> DOMString { - None + ~"" } pub fn CheckValidity(&self) -> bool { @@ -110,7 +110,7 @@ impl HTMLObjectElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -118,7 +118,7 @@ impl HTMLObjectElement { } pub fn Archive(&self) -> DOMString { - None + ~"" } pub fn SetArchive(&mut self, _archive: &DOMString) -> ErrorResult { @@ -126,7 +126,7 @@ impl HTMLObjectElement { } pub fn Code(&self) -> DOMString { - None + ~"" } pub fn SetCode(&mut self, _code: &DOMString) -> ErrorResult { @@ -150,7 +150,7 @@ impl HTMLObjectElement { } pub fn Standby(&self) -> DOMString { - None + ~"" } pub fn SetStandby(&mut self, _standby: &DOMString) -> ErrorResult { @@ -166,7 +166,7 @@ impl HTMLObjectElement { } pub fn CodeBase(&self) -> DOMString { - None + ~"" } pub fn SetCodeBase(&mut self, _codebase: &DOMString) -> ErrorResult { @@ -174,7 +174,7 @@ impl HTMLObjectElement { } pub fn CodeType(&self) -> DOMString { - None + ~"" } pub fn SetCodeType(&mut self, _codetype: &DOMString) -> ErrorResult { @@ -182,7 +182,7 @@ impl HTMLObjectElement { } pub fn Border(&self) -> DOMString { - None + ~"" } pub fn SetBorder(&mut self, _border: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlolistelement.rs b/src/components/script/dom/htmlolistelement.rs index 1a2fd349032..9a8c8617314 100644 --- a/src/components/script/dom/htmlolistelement.rs +++ b/src/components/script/dom/htmlolistelement.rs @@ -44,7 +44,7 @@ impl HTMLOListElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmloptgroupelement.rs b/src/components/script/dom/htmloptgroupelement.rs index 0bd13fbd6e3..b0876569c19 100644 --- a/src/components/script/dom/htmloptgroupelement.rs +++ b/src/components/script/dom/htmloptgroupelement.rs @@ -36,7 +36,7 @@ impl HTMLOptGroupElement { } pub fn Label(&self) -> DOMString { - None + ~"" } pub fn SetLabel(&mut self, _label: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmloptionelement.rs b/src/components/script/dom/htmloptionelement.rs index 4f7adb4b845..de82444e37e 100644 --- a/src/components/script/dom/htmloptionelement.rs +++ b/src/components/script/dom/htmloptionelement.rs @@ -40,7 +40,7 @@ impl HTMLOptionElement { } pub fn Label(&self) -> DOMString { - None + ~"" } pub fn SetLabel(&mut self, _label: &DOMString) -> ErrorResult { @@ -64,7 +64,7 @@ impl HTMLOptionElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) -> ErrorResult { @@ -72,7 +72,7 @@ impl HTMLOptionElement { } pub fn Text(&self) -> DOMString { - None + ~"" } pub fn SetText(&mut self, _text: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmloutputelement.rs b/src/components/script/dom/htmloutputelement.rs index 8c5832f1d6a..96829a4c960 100644 --- a/src/components/script/dom/htmloutputelement.rs +++ b/src/components/script/dom/htmloutputelement.rs @@ -33,7 +33,7 @@ impl HTMLOutputElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -41,11 +41,11 @@ impl HTMLOutputElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn DefaultValue(&self) -> DOMString { - None + ~"" } pub fn SetDefaultValue(&mut self, _value: &DOMString) -> ErrorResult { @@ -53,7 +53,7 @@ impl HTMLOutputElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) -> ErrorResult { @@ -76,7 +76,7 @@ impl HTMLOutputElement { } pub fn ValidationMessage(&self) -> DOMString { - None + ~"" } pub fn SetValidationMessage(&mut self, _message: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlparagraphelement.rs b/src/components/script/dom/htmlparagraphelement.rs index 2c07892f7e6..352e111e2fe 100644 --- a/src/components/script/dom/htmlparagraphelement.rs +++ b/src/components/script/dom/htmlparagraphelement.rs @@ -28,7 +28,7 @@ impl HTMLParagraphElement { impl HTMLParagraphElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlparamelement.rs b/src/components/script/dom/htmlparamelement.rs index b97eb017872..fbf82eef009 100644 --- a/src/components/script/dom/htmlparamelement.rs +++ b/src/components/script/dom/htmlparamelement.rs @@ -28,7 +28,7 @@ impl HTMLParamElement { impl HTMLParamElement { pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLParamElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLParamElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLParamElement { } pub fn ValueType(&self) -> DOMString { - None + ~"" } pub fn SetValueType(&mut self, _value_type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlquoteelement.rs b/src/components/script/dom/htmlquoteelement.rs index 5b03188c9c6..96a4a12dc0e 100644 --- a/src/components/script/dom/htmlquoteelement.rs +++ b/src/components/script/dom/htmlquoteelement.rs @@ -28,7 +28,7 @@ impl HTMLQuoteElement { impl HTMLQuoteElement { pub fn Cite(&self) -> DOMString { - None + ~"" } pub fn SetCite(&self, _cite: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlscriptelement.rs b/src/components/script/dom/htmlscriptelement.rs index ea47c904f1f..504acc85431 100644 --- a/src/components/script/dom/htmlscriptelement.rs +++ b/src/components/script/dom/htmlscriptelement.rs @@ -29,7 +29,10 @@ impl HTMLScriptElement { impl HTMLScriptElement { pub fn Src(&self) -> DOMString { - self.htmlelement.element.get_attr("src").map(|s| s.to_str()) + match self.htmlelement.element.get_attr("src") { + Some(s) => s.to_owned(), + None => ~"" + } } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -37,7 +40,7 @@ impl HTMLScriptElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -45,7 +48,7 @@ impl HTMLScriptElement { } pub fn Charset(&self) -> DOMString { - None + ~"" } pub fn SetCharset(&mut self, _charset: &DOMString) -> ErrorResult { @@ -69,7 +72,7 @@ impl HTMLScriptElement { } pub fn CrossOrigin(&self) -> DOMString { - None + ~"" } pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString) -> ErrorResult { @@ -77,7 +80,7 @@ impl HTMLScriptElement { } pub fn Text(&self) -> DOMString { - None + ~"" } pub fn SetText(&mut self, _text: &DOMString) -> ErrorResult { @@ -85,7 +88,7 @@ impl HTMLScriptElement { } pub fn Event(&self) -> DOMString { - None + ~"" } pub fn SetEvent(&mut self, _event: &DOMString) -> ErrorResult { @@ -93,7 +96,7 @@ impl HTMLScriptElement { } pub fn HtmlFor(&self) -> DOMString { - None + ~"" } pub fn SetHtmlFor(&mut self, _html_for: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlselectelement.rs b/src/components/script/dom/htmlselectelement.rs index bda52c7ed18..608295e903a 100644 --- a/src/components/script/dom/htmlselectelement.rs +++ b/src/components/script/dom/htmlselectelement.rs @@ -57,7 +57,7 @@ impl HTMLSelectElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -81,7 +81,7 @@ impl HTMLSelectElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn Length(&self) -> u32 { @@ -123,7 +123,7 @@ impl HTMLSelectElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) { @@ -145,7 +145,7 @@ impl HTMLSelectElement { } pub fn ValidationMessage(&self) -> DOMString { - None + ~"" } pub fn SetValidationMessage(&mut self, _message: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlsourceelement.rs b/src/components/script/dom/htmlsourceelement.rs index 89933a7478a..66842feb156 100644 --- a/src/components/script/dom/htmlsourceelement.rs +++ b/src/components/script/dom/htmlsourceelement.rs @@ -28,7 +28,7 @@ impl HTMLSourceElement { impl HTMLSourceElement { pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLSourceElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLSourceElement { } pub fn Media(&self) -> DOMString { - None + ~"" } pub fn SetMedia(&mut self, _media: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlstyleelement.rs b/src/components/script/dom/htmlstyleelement.rs index 88c933d851e..b532506b703 100644 --- a/src/components/script/dom/htmlstyleelement.rs +++ b/src/components/script/dom/htmlstyleelement.rs @@ -35,7 +35,7 @@ impl HTMLStyleElement { } pub fn Media(&self) -> DOMString { - None + ~"" } pub fn SetMedia(&mut self, _media: &DOMString) -> ErrorResult { @@ -43,7 +43,7 @@ impl HTMLStyleElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltablecaptionelement.rs b/src/components/script/dom/htmltablecaptionelement.rs index 788e239344a..69bd5bfb1fc 100644 --- a/src/components/script/dom/htmltablecaptionelement.rs +++ b/src/components/script/dom/htmltablecaptionelement.rs @@ -28,7 +28,7 @@ impl HTMLTableCaptionElement { impl HTMLTableCaptionElement { pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltablecellelement.rs b/src/components/script/dom/htmltablecellelement.rs index 9869bf3fb7f..9d594493ac1 100644 --- a/src/components/script/dom/htmltablecellelement.rs +++ b/src/components/script/dom/htmltablecellelement.rs @@ -37,7 +37,7 @@ impl HTMLTableCellElement { } pub fn Headers(&self) -> DOMString { - None + ~"" } pub fn SetHeaders(&self, _headers: &DOMString) -> ErrorResult { @@ -53,7 +53,7 @@ impl HTMLTableCellElement { } pub fn Abbr(&self) -> DOMString { - None + ~"" } pub fn SetAbbr(&self, _abbr: &DOMString) -> ErrorResult { @@ -61,7 +61,7 @@ impl HTMLTableCellElement { } pub fn Scope(&self) -> DOMString { - None + ~"" } pub fn SetScope(&self, _abbr: &DOMString) -> ErrorResult { @@ -69,7 +69,7 @@ impl HTMLTableCellElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&self, _align: &DOMString) -> ErrorResult { @@ -77,7 +77,7 @@ impl HTMLTableCellElement { } pub fn Axis(&self) -> DOMString { - None + ~"" } pub fn SetAxis(&self, _axis: &DOMString) -> ErrorResult { @@ -85,7 +85,7 @@ impl HTMLTableCellElement { } pub fn Height(&self) -> DOMString { - None + ~"" } pub fn SetHeight(&self, _height: &DOMString) -> ErrorResult { @@ -93,7 +93,7 @@ impl HTMLTableCellElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&self, _width: &DOMString) -> ErrorResult { @@ -101,7 +101,7 @@ impl HTMLTableCellElement { } pub fn Ch(&self) -> DOMString { - None + ~"" } pub fn SetCh(&self, _ch: &DOMString) -> ErrorResult { @@ -109,7 +109,7 @@ impl HTMLTableCellElement { } pub fn ChOff(&self) -> DOMString { - None + ~"" } pub fn SetChOff(&self, _ch_off: &DOMString) -> ErrorResult { @@ -125,7 +125,7 @@ impl HTMLTableCellElement { } pub fn VAlign(&self) -> DOMString { - None + ~"" } pub fn SetVAlign(&self, _valign: &DOMString) -> ErrorResult { @@ -133,7 +133,7 @@ impl HTMLTableCellElement { } pub fn BgColor(&self) -> DOMString { - None + ~"" } pub fn SetBgColor(&self, _bg_color: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltablecolelement.rs b/src/components/script/dom/htmltablecolelement.rs index 633e40e60f8..f17147d3dfa 100644 --- a/src/components/script/dom/htmltablecolelement.rs +++ b/src/components/script/dom/htmltablecolelement.rs @@ -36,7 +36,7 @@ impl HTMLTableColElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLTableColElement { } pub fn Ch(&self) -> DOMString { - None + ~"" } pub fn SetCh(&mut self, _ch: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLTableColElement { } pub fn ChOff(&self) -> DOMString { - None + ~"" } pub fn SetChOff(&mut self, _ch_off: &DOMString) -> ErrorResult { @@ -60,7 +60,7 @@ impl HTMLTableColElement { } pub fn VAlign(&self) -> DOMString { - None + ~"" } pub fn SetVAlign(&mut self, _v_align: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLTableColElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&mut self, _width: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltableelement.rs b/src/components/script/dom/htmltableelement.rs index 9456c8554ed..4ab2ef5c1e7 100644 --- a/src/components/script/dom/htmltableelement.rs +++ b/src/components/script/dom/htmltableelement.rs @@ -51,7 +51,7 @@ impl HTMLTableElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&self, _align: &DOMString) -> ErrorResult { @@ -59,7 +59,7 @@ impl HTMLTableElement { } pub fn Border(&self) -> DOMString { - None + ~"" } pub fn SetBorder(&self, _border: &DOMString) -> ErrorResult { @@ -67,7 +67,7 @@ impl HTMLTableElement { } pub fn Frame(&self) -> DOMString { - None + ~"" } pub fn SetFrame(&self, _frame: &DOMString) -> ErrorResult { @@ -75,7 +75,7 @@ impl HTMLTableElement { } pub fn Rules(&self) -> DOMString { - None + ~"" } pub fn SetRules(&self, _rules: &DOMString) -> ErrorResult { @@ -83,7 +83,7 @@ impl HTMLTableElement { } pub fn Summary(&self) -> DOMString { - None + ~"" } pub fn SetSummary(&self, _summary: &DOMString) -> ErrorResult { @@ -91,7 +91,7 @@ impl HTMLTableElement { } pub fn Width(&self) -> DOMString { - None + ~"" } pub fn SetWidth(&self, _width: &DOMString) -> ErrorResult { @@ -99,7 +99,7 @@ impl HTMLTableElement { } pub fn BgColor(&self) -> DOMString { - None + ~"" } pub fn SetBgColor(&self, _bg_color: &DOMString) -> ErrorResult { @@ -107,7 +107,7 @@ impl HTMLTableElement { } pub fn CellPadding(&self) -> DOMString { - None + ~"" } pub fn SetCellPadding(&self, _cell_padding: &DOMString) -> ErrorResult { @@ -115,7 +115,7 @@ impl HTMLTableElement { } pub fn CellSpacing(&self) -> DOMString { - None + ~"" } pub fn SetCellSpacing(&self, _cell_spacing: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltablerowelement.rs b/src/components/script/dom/htmltablerowelement.rs index de22597d057..a3c90d313a1 100644 --- a/src/components/script/dom/htmltablerowelement.rs +++ b/src/components/script/dom/htmltablerowelement.rs @@ -48,7 +48,7 @@ impl HTMLTableRowElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&self, _align: &DOMString) -> ErrorResult { @@ -56,7 +56,7 @@ impl HTMLTableRowElement { } pub fn Ch(&self) -> DOMString { - None + ~"" } pub fn SetCh(&self, _ch: &DOMString) -> ErrorResult { @@ -64,7 +64,7 @@ impl HTMLTableRowElement { } pub fn ChOff(&self) -> DOMString { - None + ~"" } pub fn SetChOff(&self, _ch_off: &DOMString) -> ErrorResult { @@ -72,7 +72,7 @@ impl HTMLTableRowElement { } pub fn VAlign(&self) -> DOMString { - None + ~"" } pub fn SetVAlign(&self, _v_align: &DOMString) -> ErrorResult { @@ -80,7 +80,7 @@ impl HTMLTableRowElement { } pub fn BgColor(&self) -> DOMString { - None + ~"" } pub fn SetBgColor(&self, _bg_color: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltablesectionelement.rs b/src/components/script/dom/htmltablesectionelement.rs index 8133e768ea3..2114766620c 100644 --- a/src/components/script/dom/htmltablesectionelement.rs +++ b/src/components/script/dom/htmltablesectionelement.rs @@ -32,7 +32,7 @@ impl HTMLTableSectionElement { } pub fn Align(&self) -> DOMString { - None + ~"" } pub fn SetAlign(&mut self, _align: &DOMString) -> ErrorResult { @@ -40,7 +40,7 @@ impl HTMLTableSectionElement { } pub fn Ch(&self) -> DOMString { - None + ~"" } pub fn SetCh(&mut self, _ch: &DOMString) -> ErrorResult { @@ -48,7 +48,7 @@ impl HTMLTableSectionElement { } pub fn ChOff(&self) -> DOMString { - None + ~"" } pub fn SetChOff(&mut self, _ch_off: &DOMString) -> ErrorResult { @@ -56,7 +56,7 @@ impl HTMLTableSectionElement { } pub fn VAlign(&self) -> DOMString { - None + ~"" } pub fn SetVAlign(&mut self, _v_align: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltextareaelement.rs b/src/components/script/dom/htmltextareaelement.rs index 5065d90a76e..4c5655fd6e7 100644 --- a/src/components/script/dom/htmltextareaelement.rs +++ b/src/components/script/dom/htmltextareaelement.rs @@ -60,7 +60,7 @@ impl HTMLTextAreaElement { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&mut self, _name: &DOMString) -> ErrorResult { @@ -68,7 +68,7 @@ impl HTMLTextAreaElement { } pub fn Placeholder(&self) -> DOMString { - None + ~"" } pub fn SetPlaceholder(&mut self, _placeholder: &DOMString) -> ErrorResult { @@ -100,7 +100,7 @@ impl HTMLTextAreaElement { } pub fn Wrap(&self) -> DOMString { - None + ~"" } pub fn SetWrap(&mut self, _wrap: &DOMString) -> ErrorResult { @@ -108,14 +108,14 @@ impl HTMLTextAreaElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) { } pub fn DefaultValue(&self) -> DOMString { - None + ~"" } pub fn SetDefaultValue(&mut self, _default_value: &DOMString) -> ErrorResult { @@ -123,7 +123,7 @@ impl HTMLTextAreaElement { } pub fn Value(&self) -> DOMString { - None + ~"" } pub fn SetValue(&mut self, _value: &DOMString) { @@ -146,7 +146,7 @@ impl HTMLTextAreaElement { } pub fn ValidationMessage(&self) -> DOMString { - None + ~"" } pub fn CheckValidity(&self) -> bool { @@ -176,7 +176,7 @@ impl HTMLTextAreaElement { } pub fn GetSelectionDirection(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn SetSelectionDirection(&self, _selection_direction: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltimeelement.rs b/src/components/script/dom/htmltimeelement.rs index 93c6081cb62..0c24a15a5f9 100644 --- a/src/components/script/dom/htmltimeelement.rs +++ b/src/components/script/dom/htmltimeelement.rs @@ -28,7 +28,7 @@ impl HTMLTimeElement { impl HTMLTimeElement { pub fn DateTime(&self) -> DOMString { - None + ~"" } pub fn SetDateTime(&mut self, _dateTime: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltitleelement.rs b/src/components/script/dom/htmltitleelement.rs index fd646b5b797..30113d951e4 100644 --- a/src/components/script/dom/htmltitleelement.rs +++ b/src/components/script/dom/htmltitleelement.rs @@ -28,7 +28,7 @@ impl HTMLTitleElement { impl HTMLTitleElement { pub fn Text(&self) -> DOMString { - None + ~"" } pub fn SetText(&mut self, _text: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmltrackelement.rs b/src/components/script/dom/htmltrackelement.rs index 1a5a2072356..2beed957a3f 100644 --- a/src/components/script/dom/htmltrackelement.rs +++ b/src/components/script/dom/htmltrackelement.rs @@ -28,7 +28,7 @@ impl HTMLTrackElement { impl HTMLTrackElement { pub fn Kind(&self) -> DOMString { - None + ~"" } pub fn SetKind(&mut self, _kind: &DOMString) -> ErrorResult { @@ -36,7 +36,7 @@ impl HTMLTrackElement { } pub fn Src(&self) -> DOMString { - None + ~"" } pub fn SetSrc(&mut self, _src: &DOMString) -> ErrorResult { @@ -44,7 +44,7 @@ impl HTMLTrackElement { } pub fn Srclang(&self) -> DOMString { - None + ~"" } pub fn SetSrclang(&mut self, _srclang: &DOMString) -> ErrorResult { @@ -52,7 +52,7 @@ impl HTMLTrackElement { } pub fn Label(&self) -> DOMString { - None + ~"" } pub fn SetLabel(&mut self, _label: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlulistelement.rs b/src/components/script/dom/htmlulistelement.rs index ee7df48009a..40ae76deec2 100644 --- a/src/components/script/dom/htmlulistelement.rs +++ b/src/components/script/dom/htmlulistelement.rs @@ -36,7 +36,7 @@ impl HTMLUListElement { } pub fn Type(&self) -> DOMString { - None + ~"" } pub fn SetType(&mut self, _type: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/htmlvideoelement.rs b/src/components/script/dom/htmlvideoelement.rs index b78e13947e8..690fec3956f 100644 --- a/src/components/script/dom/htmlvideoelement.rs +++ b/src/components/script/dom/htmlvideoelement.rs @@ -52,7 +52,7 @@ impl HTMLVideoElement { } pub fn Poster(&self) -> DOMString { - None + ~"" } pub fn SetPoster(&mut self, _poster: &DOMString) -> ErrorResult { diff --git a/src/components/script/dom/namespace.rs b/src/components/script/dom/namespace.rs index 7fe8e68e232..5603c67f410 100644 --- a/src/components/script/dom/namespace.rs +++ b/src/components/script/dom/namespace.rs @@ -17,7 +17,7 @@ pub enum Namespace { } impl Namespace { - pub fn from_str(url: &DOMString) -> Namespace { + pub fn from_str(url: &Option) -> Namespace { match null_str_as_empty_ref(url) { &"http://www.w3.org/1999/xhtml" => HTML, &"http://www.w3.org/XML/1998/namespace" => XML, @@ -29,7 +29,7 @@ impl Namespace { ns => Other(ns.to_owned()) } } - pub fn to_str(&self) -> DOMString { + pub fn to_str(&self) -> Option { match *self { Null => None, HTML => Some(~"http://www.w3.org/1999/xhtml"), diff --git a/src/components/script/dom/navigator.rs b/src/components/script/dom/navigator.rs index 7dbd81959b5..1d9c404545a 100644 --- a/src/components/script/dom/navigator.rs +++ b/src/components/script/dom/navigator.rs @@ -23,23 +23,23 @@ impl Navigator { } pub fn DoNotTrack(&self) -> DOMString { - Some(~"unspecified") + ~"unspecified" } pub fn Vendor(&self) -> DOMString { - Some(~"") // Like Gecko + ~"" // Like Gecko } pub fn VendorSub(&self) -> DOMString { - Some(~"") // Like Gecko + ~"" // Like Gecko } pub fn Product(&self) -> DOMString { - Some(~"Gecko") // This is supposed to be constant, see webidl. + ~"Gecko" } pub fn ProductSub(&self) -> DOMString { - None + ~"" } pub fn CookieEnabled(&self) -> bool { @@ -47,7 +47,7 @@ impl Navigator { } pub fn GetBuildID(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn JavaEnabled(&self) -> Fallible { @@ -59,26 +59,26 @@ impl Navigator { } pub fn AppName(&self) -> DOMString { - Some(~"Netscape") // Like Gecko/Webkit + ~"Netscape" // Like Gecko/Webkit } pub fn GetAppCodeName(&self) -> Fallible { - Ok(Some(~"Mozilla")) // Like Gecko/Webkit + Ok(~"Mozilla") // Like Gecko/Webkit } pub fn GetAppVersion(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn GetPlatform(&self) -> Fallible { - Ok(None) + Ok(~"") } pub fn GetUserAgent(&self) -> Fallible { - Ok(None) + Ok(~"") } - pub fn GetLanguage(&self) -> DOMString { + pub fn GetLanguage(&self) -> Option { None } diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index a6cf77d0c19..e2369b786b9 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -562,10 +562,10 @@ impl Node { } pub fn NodeName(&self, abstract_self: AbstractNode) -> DOMString { - Some(match self.type_id { + match self.type_id { ElementNodeTypeId(*) => { do abstract_self.with_imm_element |element| { - element.TagName().expect("tagName should never be null") + element.TagName() } } CommentNodeTypeId => ~"#comment", @@ -577,10 +577,10 @@ impl Node { }, DocumentFragmentNodeTypeId => ~"#document-fragment", DocumentNodeTypeId(_) => ~"#document" - }) + } } - pub fn GetBaseURI(&self) -> DOMString { + pub fn GetBaseURI(&self) -> Option { None } @@ -623,12 +623,12 @@ impl Node { self.next_sibling } - pub fn GetNodeValue(&self, abstract_self: AbstractNode) -> DOMString { + pub fn GetNodeValue(&self, abstract_self: AbstractNode) -> Option { match self.type_id { // ProcessingInstruction CommentNodeTypeId | TextNodeTypeId => { do abstract_self.with_imm_characterdata() |characterdata| { - characterdata.Data() + Some(characterdata.Data()) } } _ => { @@ -637,19 +637,18 @@ impl Node { } } - pub fn SetNodeValue(&mut self, _abstract_self: AbstractNode, _val: &DOMString) -> ErrorResult { + pub fn SetNodeValue(&mut self, _abstract_self: AbstractNode, _val: &Option) -> ErrorResult { Ok(()) } - pub fn GetTextContent(&self, abstract_self: AbstractNode) -> DOMString { + pub fn GetTextContent(&self, abstract_self: AbstractNode) -> Option { match self.type_id { DocumentFragmentNodeTypeId | ElementNodeTypeId(*) => { let mut content = ~""; for node in abstract_self.traverse_preorder() { if node.is_text() { do node.with_imm_text() |text| { - let s = text.element.Data(); - content = content + null_str_as_empty(&s); + content = content + text.element.Data(); } } } @@ -657,7 +656,7 @@ impl Node { } CommentNodeTypeId | TextNodeTypeId => { do abstract_self.with_imm_characterdata() |characterdata| { - characterdata.Data() + Some(characterdata.Data()) } } DoctypeNodeTypeId | DocumentNodeTypeId(_) => { @@ -939,18 +938,15 @@ impl Node { pub fn SetTextContent(&mut self, abstract_self: AbstractNode, - value: &DOMString) -> ErrorResult { - let is_empty = match value { - &Some(~"") | &None => true, - _ => false - }; + value: &Option) -> ErrorResult { + let value = null_str_as_empty(value); match self.type_id { DocumentFragmentNodeTypeId | ElementNodeTypeId(*) => { - let node = if is_empty { + let node = if value.len() == 0 { None } else { let document = self.owner_doc(); - Some(document.document().CreateTextNode(document, value)) + Some(document.document().CreateTextNode(document, &value)) }; self.replace_all(abstract_self, node); } @@ -958,7 +954,7 @@ impl Node { self.wait_until_safe_to_modify_dom(); do abstract_self.with_mut_characterdata() |characterdata| { - characterdata.data = null_str_as_empty(value); + characterdata.data = value.clone(); // Notify the document that the content of this node is different let document = self.owner_doc(); @@ -1019,27 +1015,27 @@ impl Node { false } - pub fn LookupPrefix(&self, _prefix: &DOMString) -> DOMString { + pub fn LookupPrefix(&self, _prefix: &Option) -> Option { None } - pub fn LookupNamespaceURI(&self, _namespace: &DOMString) -> DOMString { + pub fn LookupNamespaceURI(&self, _namespace: &Option) -> Option { None } - pub fn IsDefaultNamespace(&self, _namespace: &DOMString) -> bool { + pub fn IsDefaultNamespace(&self, _namespace: &Option) -> bool { false } - pub fn GetNamespaceURI(&self) -> DOMString { + pub fn GetNamespaceURI(&self) -> Option { None } - pub fn GetPrefix(&self) -> DOMString { + pub fn GetPrefix(&self) -> Option { None } - pub fn GetLocalName(&self) -> DOMString { + pub fn GetLocalName(&self) -> Option { None } diff --git a/src/components/script/dom/text.rs b/src/components/script/dom/text.rs index e0fd493d887..a0d866b21bd 100644 --- a/src/components/script/dom/text.rs +++ b/src/components/script/dom/text.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::TextBinding; -use dom::bindings::utils::{DOMString, Fallible, null_str_as_empty}; +use dom::bindings::utils::{DOMString, Fallible}; use dom::characterdata::CharacterData; use dom::document::AbstractDocument; use dom::node::{AbstractNode, ScriptView, Node, TextNodeTypeId}; @@ -27,7 +27,7 @@ impl Text { } pub fn Constructor(owner: @mut Window, text: &DOMString) -> Fallible> { - Ok(Text::new(null_str_as_empty(text), owner.Document())) + Ok(Text::new(text.clone(), owner.Document())) } pub fn SplitText(&self, _offset: u32) -> Fallible> { @@ -35,6 +35,6 @@ impl Text { } pub fn GetWholeText(&self) -> Fallible { - Ok(None) + Ok(~"") } } diff --git a/src/components/script/dom/window.rs b/src/components/script/dom/window.rs index b4a804464f5..093e699d3f5 100644 --- a/src/components/script/dom/window.rs +++ b/src/components/script/dom/window.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::WindowBinding; -use dom::bindings::utils::{Reflectable, Reflector}; -use dom::bindings::utils::{DOMString, null_str_as_empty, Traceable}; +use dom::bindings::utils::{Reflectable, Reflector, Traceable}; +use dom::bindings::utils::DOMString; use dom::document::AbstractDocument; use dom::eventtarget::{EventTarget, WindowTypeId}; use dom::node::{AbstractNode, ScriptView}; @@ -74,7 +74,7 @@ pub struct TimerData { impl Window { pub fn Alert(&self, s: &DOMString) { // Right now, just print to the console - println(format!("ALERT: {:s}", null_str_as_empty(s))); + println(format!("ALERT: {:s}", *s)); } pub fn Close(&self) { @@ -86,14 +86,14 @@ impl Window { } pub fn Name(&self) -> DOMString { - None + ~"" } pub fn SetName(&self, _name: &DOMString) { } pub fn Status(&self) -> DOMString { - None + ~"" } pub fn SetStatus(&self, _status: &DOMString) { @@ -127,7 +127,7 @@ impl Window { false } - pub fn Prompt(&self, _message: &DOMString, _default: &DOMString) -> DOMString { + pub fn Prompt(&self, _message: &DOMString, _default: &DOMString) -> Option { None } diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 8a21e984639..1a97730772d 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -772,7 +772,7 @@ impl ScriptTask { // "load" event as soon as we've finished executing all scripts parsed during // the initial load. let event = Event::new(window, HTMLEventTypeId); - event.mut_event().InitEvent(&Some(~"load"), false, false); + event.mut_event().InitEvent(&~"load", false, false); let doctarget = AbstractEventTarget::from_document(document); let wintarget = AbstractEventTarget::from_window(window); window.eventtarget.dispatch_event_with_target(wintarget, Some(doctarget), event); diff --git a/src/test/html/content/test_navigator.html b/src/test/html/content/test_navigator.html index c7809f36895..8ec7fc0ab3e 100644 --- a/src/test/html/content/test_navigator.html +++ b/src/test/html/content/test_navigator.html @@ -18,9 +18,9 @@ is(nav.taintEnabled(), false); is(nav.appName, "Netscape"); is(nav.appCodeName, "Mozilla"); // todo -is(nav.appVersion, null); -is(nav.platform, null); -is(nav.userAgent, null); +is(nav.appVersion, ""); +is(nav.platform, ""); +is(nav.userAgent, ""); is(nav.language, null); is(nav.onLine, true); finish();