Opened 2 weeks ago

Last modified 6 days ago

#16957 review Bug

[PFW] Styles.inliner.inline does not take selectors specificity into account and duplicates rules.

Reported by: k.krzton Owned by: k.krzton
Priority: Normal Milestone: CKEditor 4.7.0
Component: General Version:
Keywords: PFW Cc:

Description

Steps to reproduce

Having a html in dataTransfer object like

<style>
  td { color:black; }
  .xl65 { color:#C00000; }
</style>

<td class="xl65"> ... </td>

and using CKEDITOR.plugins.pastefromword.styles.inliner.inline produces a styles object like

{
  .xl65: { color: '#C00000' },
  td: { color: 'black'  }
}

Those styles are the applied to a specific element. This means the colors are applied in the incorrect order (first, color from .xl65 class, then from td - which overrides the first one). The CSS order specificity should be keep in mind here. Also the inliner does not check if same style is already defined so that the resulted styles will have two color rules. It wille result in style like color:#C00000;color:black; (it is not a big issue unless the order is correct, however it might be also improved).

See:

Two improvements could be applied here:

  • Use the proper order for CSS selectors (now there is only problem with single element and single class selectors order - copying content from Excel does not seems to create more complex selectors).
  • If the rule already exists, overwrite it.

Change History (3)

comment:1 Changed 2 weeks ago by k.krzton

  • Status changed from new to confirmed

comment:2 Changed 10 days ago by k.krzton

  • Owner set to k.krzton
  • Status changed from confirmed to assigned

comment:3 Changed 6 days ago by k.krzton

  • Status changed from assigned to review
Note: See TracTickets for help on using tickets.
© 2003 – 2016 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy