I'm designing a JavaScript selector engine, and I'm currently focused on parsing the selector string. Specifically, combinators.The CSS3 combinators I know of are:> (children)space (descendants)+ (next sibling)~ (all next siblings)Which is fine for how CSS works (how style rules are applied). However, I'm now realizing (now that I'm examining this paradigm more closely) that this seems a bit limiting in a JavaScript setting.Below I've created an alternative list of combinators. What I would like to know is:Do any of the current selector engines stray from standard CSS selection methods? (I'm familiar with Sizzle and Sly, but none of the others)Do you see any reason why any of the combinators I've listed wouldn't work well?Do you think having more selector string options (more combinators, more filters, etc) is beneficial or are just a waste/confusing/dumb/etc?Thanks all in advance for your thoughts!> (children)>> (descendants) (also, space would still work)+ (next sibling)++ (all next siblings) (also, tilde would still work)- (previous sibling)-- (all previous siblings)* (previous and next siblings)** (all siblings)^ (parent)Example 1: div ^ span - get all spans with a div childExample 2: div ** span - get all span siblings of divExample 3: .lastListItem -- li - all li previous to the li with class .lastListItemExample 4: #thing ^ div ** .error - all items with class .error that are siblings of #thing's parent (assuming #thing's parent is a div)p.s. Oh, and I also thought of having a placeholder character that could stand in for any simple selector. So, Example 4 might look like this (with an underscore as a placeholder):Example 4 alt: #thing ^ _ ** .error - all items with class .error that are siblings of #thing's parent (no matter what kind of element #thing's parent is)
Is it a bad idea to stray from CSS selector syntax in a JavaScript selector engine?
javascript;css