Skip to content

Bug in optimizePart function #82

@qmegas

Description

@qmegas

When some specific element have few classes in the selector, then optimization cause an error.

For example,

Let's say that full path looks like that: .first-elem >.second-elem.another-class >.last-elem

When optimizePart called with following arguments:

prePart = .someSelector
current = >.second-elem.another-class
postPart = > .last-elem

So when class optimisation starts to work

if (/\.\S+\.\S+/.test(current)) {

Let's say it removes part .second-elem from the selector and full selector still works fine, then it tries to remove the second class too, which creates incorrect selector like that: .first-elem > >.last-elem which cause an error when calling this line

var matches = document.querySelectorAll(pattern)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions