Make hidden input _charset_ check case insensitive

This commit is contained in:
Vincent Ricard 2020-10-09 18:05:52 +02:00
parent 14fd2e56e6
commit fa57ba5ca9
3 changed files with 3 additions and 7 deletions

View file

@ -1328,7 +1328,7 @@ pub struct FormDatum {
impl FormDatum {
pub fn replace_value(&self, charset: &str) -> String {
if self.name == "_charset_" && self.ty == "hidden" {
if self.name.to_ascii_lowercase() == "_charset_" && self.ty == "hidden" {
return charset.to_string();
}
@ -1753,7 +1753,7 @@ pub fn encode_multipart_form_data(
// Step 3
for entry in form_data.iter_mut() {
// 3.1
if entry.name == "_charset_" && entry.ty == "hidden" {
if entry.name.to_ascii_lowercase() == "_charset_" && entry.ty == "hidden" {
entry.value = FormDatumValue::String(DOMString::from(charset.clone()));
}
// TODO: 3.2

View file

@ -1759,7 +1759,7 @@ impl HTMLInputElement {
// Step 5.10: it's a hidden field named _charset_
InputType::Hidden => {
if name == "_charset_" {
if name.to_ascii_lowercase() == "_charset_" {
return vec![FormDatum {
ty: ty.clone(),
name: name,

View file

@ -1,4 +0,0 @@
[hidden-charset-case-sensitive.html]
[keyword _charset_]
expected: FAIL