Make DOMString an alias for Option<~str>

Fixes #898.
This commit is contained in:
Keegan McAllister 2013-09-18 14:46:42 -07:00
parent 5be084a3b6
commit 68ddc6b4ab
69 changed files with 435 additions and 461 deletions

View file

@ -2,7 +2,7 @@
* 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::utils::{DOMString, str, null_string, ErrorResult};
use dom::bindings::utils::{DOMString, ErrorResult, null_str_as_empty};
use dom::htmlelement::HTMLElement;
use dom::node::{ScriptView, AbstractNode};
use extra::url::Url;
@ -40,7 +40,7 @@ impl HTMLImageElement {
}
pub fn AfterSetAttr(&mut self, name: &DOMString, _value: &DOMString) {
let name = name.to_str();
let name = null_str_as_empty(name);
if "src" == name {
let doc = self.parent.parent.parent.owner_doc;
for doc in doc.iter() {
@ -55,14 +55,14 @@ impl HTMLImageElement {
}
pub fn Alt(&self) -> DOMString {
null_string
None
}
pub fn SetAlt(&mut self, _alt: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Src(&self, _abstract_self: AbstractNode<ScriptView>) -> DOMString {
null_string
None
}
pub fn SetSrc(&mut self,
@ -71,19 +71,19 @@ impl HTMLImageElement {
_rv: &mut ErrorResult) {
let node = &mut self.parent.parent;
node.set_attr(abstract_self,
&str(~"src"),
&str(src.to_str()));
&Some(~"src"),
&Some(null_str_as_empty(src)));
}
pub fn CrossOrigin(&self) -> DOMString {
null_string
None
}
pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString, _rv: &mut ErrorResult) {
}
pub fn UseMap(&self) -> DOMString {
null_string
None
}
pub fn SetUseMap(&mut self, _use_map: &DOMString, _rv: &mut ErrorResult) {
@ -129,8 +129,8 @@ impl HTMLImageElement {
_rv: &mut ErrorResult) {
let node = &mut self.parent.parent;
node.set_attr(abstract_self,
&str(~"width"),
&str(width.to_str()));
&Some(~"width"),
&Some(width.to_str()));
}
pub fn Height(&self, abstract_self: AbstractNode<ScriptView>) -> u32 {
@ -166,8 +166,8 @@ impl HTMLImageElement {
_rv: &mut ErrorResult) {
let node = &mut self.parent.parent;
node.set_attr(abstract_self,
&str(~"height"),
&str(height.to_str()));
&Some(~"height"),
&Some(height.to_str()));
}
pub fn NaturalWidth(&self) -> u32 {
@ -183,14 +183,14 @@ impl HTMLImageElement {
}
pub fn Name(&self) -> DOMString {
null_string
None
}
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Align(&self) -> DOMString {
null_string
None
}
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
@ -211,14 +211,14 @@ impl HTMLImageElement {
}
pub fn LongDesc(&self) -> DOMString {
null_string
None
}
pub fn SetLongDesc(&mut self, _longdesc: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Border(&self) -> DOMString {
null_string
None
}
pub fn SetBorder(&mut self, _border: &DOMString, _rv: &mut ErrorResult) {