Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

can.observe.delegate selectors with values have poorly defined grammar #121

Closed
rjgotten opened this Issue · 3 comments

4 participants

@rjgotten

Values with spaces in them, e.g., foo=bar baz are not supported. These will always be interpreted as matching foo=bar or matching baz.

(Due to the logic bug related to AND/OR semantics in the presence of selectors with values mentioned in issue #119, it will actually only match baz when the same observable can match foo=bar as well...)

Values with a trailing comma are ambiguous, due to the optional nature of the comma and the lack of quotes around values. E.g. the first attribute in the selector foo=bar, baz could be interpreted as foo=bar ( "foo" with value "bar" ) or "foo=bar," ( "foo" with value "bar," ). Note the comma.

(Due to the parser bug with comma separated values from issue #120, currently it will match the value "bar,", including the comma. This is also the least likely of the two interpretations to match the original author intent...)

You can resolve both problems with the selector grammar by forcing specified values to be quoted.

@justinbmeyer

I dislike quotes within quotes. I purposefully wanted to ignore matching against values with spaces to make the syntax appear more easily. This is because I've only ever needed rather basic delegate rules on observes.

But, I think this is a good change. I need to schedule some time with you to see what you are building and how you are using delegate.

@dispatchrabbi

Now you should be able to specify quoted values. For values with no spaces, though, you can still leave the quotes off. So your selectors can look like:

foo bar=a baz="b b" qux="c c"

This doesn't address all the issues above, but it's progress.

@rjgotten

I need to schedule some time with you to see what you are building and how you are using delegate.

It's not something I directly needed. I just noticed the potential problems with the delegate grammar when I started making other changes to the delegates plugin. Figured I might as well report them. Glad to see the issue resolved though, as it pulls the capabilities more in line with the attribute selector support in DOM query selectors. And if nothing else, it adds an additional layer of polish to the delegates feature.

@imjoshdean imjoshdean closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.