[webkit-reviews] review granted: [Bug 55111] getComputedStyle() returns unitless values for some properties that require units : [Attachment 90103] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Apr 26 15:42:39 PDT 2011
Ojan Vafai <ojan at chromium.org> has granted Emil A Eklund <eae at chromium.org>'s
request for review:
Bug 55111: getComputedStyle() returns unitless values for some properties that
require units
https://bugs.webkit.org/show_bug.cgi?id=55111
Attachment 90103: Patch
https://bugs.webkit.org/attachment.cgi?id=90103&action=review
------- Additional Comments from Ojan Vafai <ojan at chromium.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=90103&action=review
> LayoutTests/fast/css/getComputedStyle/getComputedStyle-length-unit.html:93
> + for (var propertyName in propertiesToCheck) {
> + testElement.style[propertyName] =
propertiesToCheck[propertyName];
> + }
> +
> + function testPropertyUnit(className, propertyName)
> + {
> + if (testElement.className != className)
> + testElement.className = className;
> + var computedStyled =
document.defaultView.getComputedStyle(testElement);
> + var results = /\d+([a-z%]+)/.exec(computedStyled[propertyName]);
> + return results ? results[1] : '';
> + }
> +
> + for (var propertyName in propertiesToCheck) {
> + shouldBe("testPropertyUnit('visible', '" + propertyName + "')",
"'px'");
> + }
> + for (var propertyName in propertiesToCheck) {
> + shouldBe("testPropertyUnit('hidden', '" + propertyName + "')",
"'px'");
> + }
> +
> + for (var propertyName in propertiesToCheck) {
> + testElement.style[propertyName] = '';
> + }
nit: although we don't enforce style for tests, webkit style is to not include
curly braces for one-line if/else/for/while statements.
More information about the webkit-reviews
mailing list