Fix id/class collection from stylesheets

BUG=438036
R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/785313002
This commit is contained in:
Rafael Weinstein 2014-12-09 15:05:42 -08:00
parent b6e7ba2dfc
commit fe9aa27ab5
3 changed files with 38 additions and 3 deletions

View File

@ -67,10 +67,10 @@ void RuleFeatureSet::collectFeaturesFromRuleData(const RuleData& ruleData)
void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector)
{
addSelectorFeatures(selector);
for (const CSSSelector* current = &selector; current; current = current->tagHistory())
for (const CSSSelector* current = &selector; current; current = current->tagHistory()) {
addSelectorFeatures(*current);
collectFeaturesFromSelectorList(current->selectorList());
}
}
void RuleFeatureSet::collectFeaturesFromSelectorList(const CSSSelectorList* selectorList)

View File

@ -0,0 +1,6 @@
Running 2 tests
ok 1 Div width should grow width to 200px
ok 2 Div width should grow height to 200px
2 tests
2 pass
0 fail

View File

@ -0,0 +1,29 @@
<sky>
<import src="../resources/mocha.sky" />
<import src="../resources/chai.sky" />
<style>
div { width: 100px; height: 100px; background-color: red; }
div.wide { width: 200px; }
div#high { height: 200px; }
</style>
<div></div>
<div></div>
<script>
describe("Div width", function() {
it("should grow width to 200px", function() {
var target = document.querySelector('div');
target.classList.add("wide");
assert.equal(getComputedStyle(target).width, "200px");
});
it("should grow height to 200px", function() {
var target = document.querySelectorAll('div')[1];
target.id = 'high';
assert.equal(getComputedStyle(target).height, "200px");
});
});
</script>
</sky>