mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Lower case the type attribute before checking if it's JS
This commit is contained in:
parent
64cc9ec688
commit
d84c0fc52a
2 changed files with 4 additions and 88 deletions
|
@ -2,6 +2,8 @@
|
|||
* 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 std::ascii::AsciiExt;
|
||||
|
||||
use dom::attr::Attr;
|
||||
use dom::attr::AttrHelpers;
|
||||
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
|
||||
|
@ -216,7 +218,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
|
|||
},
|
||||
Some(ref s) => {
|
||||
debug!("script type={:s}", *s);
|
||||
SCRIPT_JS_MIMES.contains(&s.as_slice().trim_chars(HTML_SPACE_CHARACTERS))
|
||||
SCRIPT_JS_MIMES.contains(&s.to_ascii_lower().as_slice().trim_chars(HTML_SPACE_CHARACTERS))
|
||||
},
|
||||
None => {
|
||||
debug!("no script type");
|
||||
|
@ -229,7 +231,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
|
|||
},
|
||||
Some(ref s) => {
|
||||
debug!("script language={:s}", *s);
|
||||
SCRIPT_JS_MIMES.contains(&format!("text/{}", s).as_slice())
|
||||
SCRIPT_JS_MIMES.contains(&format!("text/{}", s).to_ascii_lower().as_slice())
|
||||
},
|
||||
None => {
|
||||
debug!("no script type or language, inferring js");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue