Remove div shorthand

This commit is contained in:
Wim Looman 2016-02-07 10:59:20 +01:00
parent 359079ca6c
commit da86d54b05
2 changed files with 9 additions and 13 deletions
maud_macros

View file

@ -190,10 +190,6 @@ impl<'cx, 'i> Parser<'cx, 'i> {
let name = try!(self.name());
try!(self.element(sp, &name));
},
// Shorthand div element
[dot!(), ident!(sp, _), ..] => {
try!(self.element(sp, "div"));
},
// Block
[TokenTree::Delimited(_, ref d), ..] if d.delim == DelimToken::Brace => {
self.shift(1);

View file

@ -339,10 +339,10 @@ fn class_shorthand() {
}
#[test]
fn div_class_shorthand() {
fn class_shorthand_with_space() {
let mut s = String::new();
html!(s, p { "Hi, " .name { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <div class=\"name\">Lyra</div>!</p>");
html!(s, p { "Hi, " span .name { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <span class=\"name\">Lyra</span>!</p>");
}
#[test]
@ -353,15 +353,15 @@ fn classes_shorthand() {
}
#[test]
fn div_classes_shorthand() {
fn classes_shorthand_with_space() {
let mut s = String::new();
html!(s, p { "Hi, " .name.here { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <div class=\"name here\">Lyra</div>!</p>");
html!(s, p { "Hi, " span .name .here { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <span class=\"name here\">Lyra</span>!</p>");
}
#[test]
fn div_classes_shorthand_with_attrs() {
fn classes_shorthand_with_attrs() {
let mut s = String::new();
html!(s, p { "Hi, " .name.here id="thing" { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <div class=\"name here\" id=\"thing\">Lyra</div>!</p>");
html!(s, p { "Hi, " span.name.here id="thing" { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <span class=\"name here\" id=\"thing\">Lyra</span>!</p>");
}