mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Parse url in getter method
This commit is contained in:
parent
37aa21d8db
commit
02d28e02e3
1 changed files with 6 additions and 6 deletions
|
@ -1501,16 +1501,16 @@ impl Element {
|
||||||
};
|
};
|
||||||
let value = &**attr.value();
|
let value = &**attr.value();
|
||||||
// XXXManishearth this doesn't handle `javascript:` urls properly
|
// XXXManishearth this doesn't handle `javascript:` urls properly
|
||||||
USVString(value.to_owned())
|
document_from_node(self)
|
||||||
|
.base_url()
|
||||||
|
.join(value)
|
||||||
|
.map(|parsed| USVString(parsed.into_string()))
|
||||||
|
.unwrap_or_else(|_| USVString(value.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_url_attribute(&self, local_name: &LocalName, value: USVString) {
|
pub fn set_url_attribute(&self, local_name: &LocalName, value: USVString) {
|
||||||
assert!(*local_name == local_name.to_ascii_lowercase());
|
assert!(*local_name == local_name.to_ascii_lowercase());
|
||||||
let base_url = document_from_node(self).base_url();
|
self.set_attribute(local_name, AttrValue::String(value.to_string()));
|
||||||
self.set_attribute(
|
|
||||||
local_name,
|
|
||||||
AttrValue::from_resolved_url(&base_url, value.to_string()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_string_attribute(&self, local_name: &LocalName) -> DOMString {
|
pub fn get_string_attribute(&self, local_name: &LocalName) -> DOMString {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue