Revert "Fix problems with applying css-styles to elements"

This reverts commit c41759f246.

Reason for revert: this breaks the chips style in polymer 1

Change-Id: I6a5d2fc0e888cde99d3c99d2e5c50f34485464a3
This commit is contained in:
Tao Zhou
2019-08-14 07:56:27 +00:00
parent b74517d966
commit 9558a6e306
7 changed files with 26 additions and 96 deletions

View File

@@ -76,31 +76,14 @@ limitations under the License.
on-focus="_onInputFocus"
on-blur="_onInputBlur"
autocomplete="off">
<template is="dom-if" if="[[_isPolymer2()]]">
<!-- Content uses vertical-align:baseline. If iron-icon is placed
directly in the slot and is not visible, vertical-align doesn't
work, because display:none convert it from inline-block element to
block element. To fix this problem, iron-icon is wrapped in div
which never changes display type.
The problem doesn't exist in Polymer1 because DOM is different.
Applying the same fix to Polymer1 breaks vertical-align.
-->
<div slot="prefix">
<iron-icon
icon="gr-icons:search"
class$="searchIcon [[_computeShowSearchIconClass(showSearchIcon)]]">
</iron-icon>
</div>
</template>
<template is="dom-if" if="[[!_isPolymer2()]]">
<iron-icon
prefix
<!-- slot is for future use (2.x) while prefix attribute is for 1.x
(current) -->
<iron-icon
icon="gr-icons:search"
slot="prefix"
prefix
class$="searchIcon [[_computeShowSearchIconClass(showSearchIcon)]]">
</iron-icon>
</template>
</iron-icon>
</paper-input>
<gr-autocomplete-dropdown
vertical-align="top"

View File

@@ -425,9 +425,5 @@
_computeShowSearchIconClass(showSearchIcon) {
return showSearchIcon ? 'showSearchIcon' : '';
},
_isPolymer2() {
return window.POLYMER2;
},
});
})();

View File

@@ -320,15 +320,12 @@ limitations under the License.
});
});
test('search icon shows with showSearchIcon property', done => {
flush(() => {
assert.equal(getComputedStyle(element.$$('iron-icon')).display,
'none');
element.showSearchIcon = true;
assert.notEqual(getComputedStyle(element.$$('iron-icon')).display,
'none');
done();
});
test('search icon shows with showSearchIcon property', () => {
assert.equal(getComputedStyle(element.$$('iron-icon')).display,
'none');
element.showSearchIcon = true;
assert.notEqual(getComputedStyle(element.$$('iron-icon')).display,
'none');
});
test('vertical offset overridden by param if it exists', () => {