@@ -109,7 +109,6 @@ mod parser;
109
109
110
110
use cssparser:: CowRcStr ;
111
111
pub use error:: InlineError ;
112
- use parser:: Rule ;
113
112
use smallvec:: { smallvec, SmallVec } ;
114
113
use std:: {
115
114
borrow:: Cow ,
@@ -344,20 +343,16 @@ fn process_css(document: &NodeRef, css: &str) -> Result<()> {
344
343
cssparser:: RuleListParser :: new_for_stylesheet ( & mut parser, parser:: CSSRuleListParser ) ;
345
344
for parsed in rule_list {
346
345
if let Ok ( ( selector, declarations) ) = parsed {
347
- if let Ok ( rule) = Rule :: new ( selector, declarations) {
348
- let matching_elements = document
349
- . inclusive_descendants ( )
350
- . filter_map ( |node| node. into_element_ref ( ) )
351
- . filter ( |element| rule. selectors . matches ( element) ) ;
346
+ if let Ok ( matching_elements) = document. select ( selector) {
352
347
for matching_element in matching_elements {
353
348
// It can be borrowed if the current selector matches <link> tag, that is
354
349
// already borrowed in `inline_to`. We can ignore such matches
355
350
if let Ok ( mut attributes) = matching_element. attributes . try_borrow_mut ( ) {
356
351
if let Some ( existing_style) = attributes. get_mut ( "style" ) {
357
- * existing_style = merge_styles ( existing_style, & rule . declarations ) ?
352
+ * existing_style = merge_styles ( existing_style, & declarations) ?
358
353
} else {
359
354
let mut final_styles = String :: with_capacity ( 64 ) ;
360
- for ( name, value) in & rule . declarations {
355
+ for ( name, value) in & declarations {
361
356
final_styles. push_str ( name) ;
362
357
final_styles. push ( ':' ) ;
363
358
final_styles. push_str ( value) ;
0 commit comments