LeaVerou/parsel

Unexpected trimmed attribute selector value

KillyMXI opened this issue · 1 comments

Given the input [foo=ss][bar=ii] I'd expect two-letter value for each attribute selector.
Instead, one letter is interpreted as the case sensitivity modifier.

From a brief look I can't find any note about this corner case in HTML spec.

Browsers seem to follow more intuitive interpretation: if no quotes and no whitespace then it's a part of the value. (If no quotes and the first whitespace group is not followed by the single i or s character than the rule is ignored as invalid.)

I'd suggest to not consider the i or s character before closing ] as a modifier in case

  • either it is not preceded by a whitespace;
  • or it is not the only character after the first whitespace group.

The difference between implementations will be present in the output for [foo=s s s]. There is no intuitive best interpretation so it seems fine to have any, unlike the case with no spaces.

Yup, that's definitely a bug. Thanks!