CSSJanus: Account for attribute selectors in brace lookahead
authorRoan Kattouw <roan.kattouw@gmail.com>
Mon, 6 Jan 2014 06:51:54 +0000 (14:51 +0800)
committerKrinkle <krinklemail@gmail.com>
Sat, 8 Feb 2014 00:43:52 +0000 (00:43 +0000)
commite5096f2500c4077defff0367a87ea198a9ab89d3
tree0c7ec8c2e3119260aa01b63ebf4aa97fcbf7db7f
parent063eca1c5c5dc2ea2685b3e8a9cf855356eeda6c
CSSJanus: Account for attribute selectors in brace lookahead

Recognize selectors of the forms [attr=val], [attr*=val], [attr~=val]
and [attr^=val], optionally with single-quoted values.

Because these selectors previously weren't recognized, trying to
apply /* @noflip */ to one of them would be recognized as a
single-property noflip rather than a rule-wide noflip, and so only
the first property in the rule would be noflipped.

The (simplified) input that triggered this bug was:

/* @noflip */ figure[typeof*='mw:Image'].mw-halign-left { clear: left; float: left; }

which became { clear: left; float: right; } when run through CSSJanus.

See also I4cddce80397d8 which is a workaround for this issue

Bug: 50910
Change-Id: If424a1df26bb7a5a18cee4b0318b029392528fc0
includes/libs/CSSJanus.php
tests/phpunit/includes/libs/CSSJanusTest.php