Skip to content

Commit

Permalink
preserve !important rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mderazon committed Mar 8, 2015
1 parent 4ae813c commit a7099cc
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 a7099cc

Please sign in to comment.