mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Implement document.characterSet
Spec: http://dom.spec.whatwg.org/#dom-document-characterset This is a sub-task for #1428.
This commit is contained in:
parent
17bc467b83
commit
a6c897e445
8 changed files with 100 additions and 6 deletions
|
@ -93,7 +93,8 @@ pub struct Document {
|
|||
implementation: Option<@mut DOMImplementation>,
|
||||
content_type: DOMString,
|
||||
url: Url,
|
||||
quirks_mode: QuirksMode
|
||||
quirks_mode: QuirksMode,
|
||||
encoding_name: DOMString,
|
||||
}
|
||||
|
||||
impl Document {
|
||||
|
@ -140,7 +141,9 @@ impl Document {
|
|||
Some(_url) => _url
|
||||
},
|
||||
// http://dom.spec.whatwg.org/#concept-document-quirks
|
||||
quirks_mode: NoQuirks
|
||||
quirks_mode: NoQuirks,
|
||||
// http://dom.spec.whatwg.org/#concept-document-encoding
|
||||
encoding_name: ~"utf-8",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,6 +210,15 @@ impl Document {
|
|||
self.quirks_mode = mode;
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-characterset
|
||||
pub fn CharacterSet(&self) -> DOMString {
|
||||
self.encoding_name.to_ascii_lower()
|
||||
}
|
||||
|
||||
pub fn set_encoding_name(&mut self, name: DOMString) {
|
||||
self.encoding_name = name;
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-content_type
|
||||
pub fn ContentType(&self) -> DOMString {
|
||||
self.content_type.clone()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue