mirror of
https://github.com/servo/servo.git
synced 2025-07-16 11:53:39 +01:00
Add support for caseless group name matching in HTML input elements
This commit is contained in:
parent
4823ec947e
commit
5c9a25d46b
6 changed files with 19 additions and 23 deletions
|
@ -90,3 +90,4 @@ euclid = "0.2"
|
||||||
tendril = "0.1.1"
|
tendril = "0.1.1"
|
||||||
rand = "0.3"
|
rand = "0.3"
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
|
caseless = "0.1.0"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use caseless::compatibility_caseless_match_str;
|
||||||
use dom::activation::Activatable;
|
use dom::activation::Activatable;
|
||||||
use dom::attr::{Attr, AttrValue};
|
use dom::attr::{Attr, AttrValue};
|
||||||
use dom::bindings::cell::DOMRefCell;
|
use dom::bindings::cell::DOMRefCell;
|
||||||
|
@ -388,9 +389,8 @@ fn in_same_group(other: &HTMLInputElement, owner: Option<&HTMLFormElement>,
|
||||||
other.input_type.get() == InputType::InputRadio &&
|
other.input_type.get() == InputType::InputRadio &&
|
||||||
// TODO Both a and b are in the same home subtree.
|
// TODO Both a and b are in the same home subtree.
|
||||||
other_owner == owner &&
|
other_owner == owner &&
|
||||||
// TODO should be a unicode compatibility caseless match
|
|
||||||
match (other.get_radio_group_name(), group) {
|
match (other.get_radio_group_name(), group) {
|
||||||
(Some(ref s1), Some(s2)) => s1 == s2 && s2 != &atom!(""),
|
(Some(ref s1), Some(s2)) => compatibility_caseless_match_str(s1, s2) && s2 != &atom!(""),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ extern crate util;
|
||||||
extern crate angle;
|
extern crate angle;
|
||||||
extern crate canvas;
|
extern crate canvas;
|
||||||
extern crate canvas_traits;
|
extern crate canvas_traits;
|
||||||
|
extern crate caseless;
|
||||||
extern crate core;
|
extern crate core;
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
extern crate devtools_traits;
|
extern crate devtools_traits;
|
||||||
|
|
15
components/servo/Cargo.lock
generated
15
components/servo/Cargo.lock
generated
|
@ -167,6 +167,15 @@ dependencies = [
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "caseless"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-normalization 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cgl"
|
name = "cgl"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -1442,6 +1451,7 @@ dependencies = [
|
||||||
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"canvas 0.0.1",
|
"canvas 0.0.1",
|
||||||
"canvas_traits 0.0.1",
|
"canvas_traits 0.0.1",
|
||||||
|
"caseless 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"devtools_traits 0.0.1",
|
"devtools_traits 0.0.1",
|
||||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1780,6 +1790,11 @@ dependencies = [
|
||||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-normalization"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-script"
|
name = "unicode-script"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
|
|
@ -1,23 +1,5 @@
|
||||||
[radio-groupname-case.html]
|
[radio-groupname-case.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[radio button group name = sImPlE]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[radio button group name = paSSfield-killroyß]
|
[radio button group name = paSSfield-killroyß]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[radio button group name = глупый]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[radio button group name = åωk]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[radio button group name = blah1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[radio button group name = tÉdz5アパートFi]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[radio button group name = ΣΣ]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,3 @@
|
||||||
[canceled activation steps on unchecked radio]
|
[canceled activation steps on unchecked radio]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[radio inputs with name attributes groüp2 and groÜp2 belong to the same radio button group]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue