Thread ParseError return values through CSS parsing.

This commit is contained in:
Josh Matthews 2017-04-28 00:35:22 -04:00
parent 58e39bfffa
commit 27ae1ef2e7
121 changed files with 2133 additions and 1505 deletions

View file

@ -6,10 +6,11 @@
#![deny(missing_docs)]
use cssparser::Parser as CssParser;
use cssparser::{Parser as CssParser, ParserInput};
use selectors::Element;
use selectors::parser::SelectorList;
use std::fmt::Debug;
use style_traits::ParseError;
use stylesheets::{Origin, Namespaces};
/// A convenient alias for the type that represents an attribute value used for
@ -59,13 +60,14 @@ impl<'a> SelectorParser<'a> {
///
/// This is used for some DOM APIs like `querySelector`.
pub fn parse_author_origin_no_namespace(input: &str)
-> Result<SelectorList<SelectorImpl>, ()> {
-> Result<SelectorList<SelectorImpl>, ParseError> {
let namespaces = Namespaces::default();
let parser = SelectorParser {
stylesheet_origin: Origin::Author,
namespaces: &namespaces,
};
SelectorList::parse(&parser, &mut CssParser::new(input))
let mut input = ParserInput::new(input);
SelectorList::parse(&parser, &mut CssParser::new(&mut input))
}
/// Whether we're parsing selectors in a user-agent stylesheet.