Skip to content

Commit

Permalink
Merge pull request #45 from mderazon/master
Browse files Browse the repository at this point in the history
fixing the preservation of !important rules - #44
  • Loading branch information
rodneyrehm committed Mar 10, 2015
2 parents 4ae813c + a7099cc commit 6139913
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
filter: progid:DXImageTransform.Microsoft.DropShadow(OffX=1vh, OffY=1vw, Color=#000000);
}

.priority-important-test {
height: 20.3vh !important;
}

.use_css_content_hack-test {
content: 'viewport-units-buggyfill; width: 80vmax; height: 80vmax;';
}
Expand Down
5 changes: 5 additions & 0 deletions viewport-units-buggyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@

forEach.call(rule.style, function(name) {
var value = rule.style.getPropertyValue(name);
// preserve those !important rules
if (rule.style.getPropertyPriority(name)) {
value += ' !important';
}

viewportUnitExpression.lastIndex = 0;
if (viewportUnitExpression.test(value)) {
declarations.push([rule, name, value]);
Expand Down

0 comments on commit 6139913

Please sign in to comment.