mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Parse attributes according to the specification in AttrValue::from_u32.
This exposes another bug: "-0" failed to parse with str.parse(), and is now successfully parsed into 0. However, input.size and textarea.{rows, cols} are supposed to be "limited to only non-negative numbers greater than zero", so 0 is not actually supposed to be accepted.
This commit is contained in:
parent
8b8daa24b8
commit
dd9351d722
3 changed files with 11 additions and 93 deletions
|
@ -16,7 +16,7 @@ use dom::window::Window;
|
|||
use dom::virtualmethods::vtable_for;
|
||||
|
||||
use devtools_traits::AttrInfo;
|
||||
use util::str::{DOMString, split_html_space_chars};
|
||||
use util::str::{DOMString, parse_unsigned_integer, split_html_space_chars};
|
||||
|
||||
use string_cache::{Atom, Namespace};
|
||||
|
||||
|
@ -55,8 +55,7 @@ impl AttrValue {
|
|||
}
|
||||
|
||||
pub fn from_u32(string: DOMString, default: u32) -> AttrValue {
|
||||
// XXX Is parse() correct?
|
||||
let result: u32 = string.parse().unwrap_or(default);
|
||||
let result = parse_unsigned_integer(string.chars()).unwrap_or(default);
|
||||
AttrValue::UInt(string, result)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue