Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some CSS attribute selectors and pseudoclasses fixes #303

Merged
merged 3 commits into from
Aug 3, 2019

Commits on Aug 3, 2019

  1. Force a re-render when :last-child & other pseudoclasses are met

    In the initial loading phase, when the HTML is parsed and the DOM
    is being built, and styles computed (cause we know enough: the node
    class, all the parents), when meeting the nodes as they are parsed,
    the current node is... always the last child (which might be the only
    thing we don't know yet...). So, some CSS pseudoclasses like:
        :last-child :last-of-type
        :nth-last-child() :nth-last-of-type()
        :only-child :only-of-type
    might be matched on more nodes that they should.
    So, when meeting such a pseudoclass, we flag that a re-render
    is needed, which will be done on the fully made DOM, so they
    are matched correctly.
    poire-z committed Aug 3, 2019
    Configuration menu
    Copy the full SHA
    709ae63 View commit details
    Browse the repository at this point in the history
  2. CSS: attribute selectors: don't check when there is no such attribute

    An empty string attribute selector (div[attr=""]) should not
    match a node when that attribute is absent.
    (getAttributeValue() returns an empty string when the attribute
    is absent, that would make us do some work with it.)
    This should also avoid the expensive lowercase() needed by our
    epub.css attribute selectors (eg. br[clear=left i]) when there
    is no clear= attribute on the <br> we meet.
    poire-z committed Aug 3, 2019
    Configuration menu
    Copy the full SHA
    c187c0f View commit details
    Browse the repository at this point in the history
  3. CSS: attribute selectors: fix parsing of case insensitive flag

    The ' i' flag should be outside the parenthesis with the attribute
    value:
    div[foo="bar i"] should not match foo="bar" nor foo="BAR", but
    only foo="bar i".
    
    Also, "div[foo=], blockquote {...}" is invalid and should make
    the whole declaration discarded (including the blockquote).
    poire-z committed Aug 3, 2019
    Configuration menu
    Copy the full SHA
    9a1bbd0 View commit details
    Browse the repository at this point in the history