mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #18644 - Manishearth:stylo-attr-ws, r=bz
stylo: Don't error out on trailing whitespace in attr() r=bz bug 1403282 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18644) <!-- Reviewable:end -->
This commit is contained in:
commit
97227aaca3
1 changed files with 24 additions and 20 deletions
|
@ -740,9 +740,7 @@ impl Attr {
|
|||
let first = input.try(|i| i.expect_ident_cloned()).ok();
|
||||
if let Ok(token) = input.try(|i| i.next_including_whitespace().map(|t| t.clone())) {
|
||||
match token {
|
||||
Token::Delim('|') => {}
|
||||
ref t => return Err(BasicParseError::UnexpectedToken(t.clone()).into()),
|
||||
}
|
||||
Token::Delim('|') => {
|
||||
// must be followed by an ident
|
||||
let second_token = match *input.next_including_whitespace()? {
|
||||
Token::Ident(ref second) => second,
|
||||
|
@ -763,6 +761,12 @@ impl Attr {
|
|||
attribute: second_token.as_ref().to_owned(),
|
||||
})
|
||||
}
|
||||
// In the case of attr(foobar ) we don't want to error out
|
||||
// because of the trailing whitespace
|
||||
Token::WhiteSpace(_) => (),
|
||||
ref t => return Err(BasicParseError::UnexpectedToken(t.clone()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(first) = first {
|
||||
Ok(Attr {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue