mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update to selectors 0.15
This commit is contained in:
parent
a89ba50180
commit
82b13d50e3
21 changed files with 215 additions and 146 deletions
|
@ -3,14 +3,18 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::{Parser, ToCss};
|
||||
use selectors::parser::{Selector, ParserContext, parse_selector_list};
|
||||
use style::selector_parser::TheSelectorImpl;
|
||||
use selectors::parser::SelectorList;
|
||||
use style::selector_parser::{TheSelectorImpl, SelectorParser};
|
||||
use style::stylesheets::{Origin, Namespaces};
|
||||
|
||||
fn parse(input: &mut Parser) -> Result<Selector<TheSelectorImpl>, ()> {
|
||||
let mut context = ParserContext::new();
|
||||
context.in_user_agent_stylesheet = true;
|
||||
context.namespace_prefixes.insert("svg".into(), ns!(svg));
|
||||
parse_selector_list(&context, input).map(|mut vec| vec.pop().unwrap())
|
||||
fn parse(input: &mut Parser) -> Result<SelectorList<TheSelectorImpl>, ()> {
|
||||
let mut ns = Namespaces::default();
|
||||
ns.prefixes.insert("svg".into(), ns!(svg));
|
||||
let parser = SelectorParser {
|
||||
stylesheet_origin: Origin::UserAgent,
|
||||
namespaces: &ns,
|
||||
};
|
||||
SelectorList::parse(&parser, input)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue