// @category hacks @import "util"; // hack to support negative margins in legacy IE // @mixin hack-negative-margin @mixin hack-negative-margin() { @if($legacy-support-for-ie6 or $legacy-support-for-ie7) { @include has-layout(); position: relative; } } // max-height hack // @mixin max-height // @param $value {String} the height @mixin max-height($value) { @include hacked-maximum(height, $value); } // max-width hack // @mixin max-width // @param $value {String} the width @mixin max-width($value) { @include hacked-maximum(width, $value); } // generic max-* hack wrapper // @mixin hacked-maximum // @param $property {String} property [height|width] // @param $value {String} the value @mixin hacked-maximum($property, $value) { max-#{$property}: $value; @include bang-hack($property, auto, $value); } // proxy for ie-pseudo // @mixin ie-pseudo-before // @param $styles {String} the styles to apply to the pseudo-element // @param $content {String} the content to insert into the element (similar to css `content` attribute) // @param $name {String} the name of the element @mixin ie-pseudo-before($styles: false, $content: false, $name: '') { @include ie-pseudo($styles, $content, before, $name); } // proxy for ie-pseudo // @mixin ie-pseudo-after // @param $styles {String} the styles to apply to the pseudo-element // @param $content {String} the content to insert into the element (similar to css `content` attribute) // @param $name {String} the name of the element @mixin ie-pseudo-after($styles: false, $content: false, $name: '') { @include ie-pseudo($styles, $content, after, $name); } // this creates a one-type executing expression that inserts an element relative to `this` element. // this allows some level of support for :before/:after in IE6/7 // inspired by http://nicolasgallagher.com/better-float-containment-in-ie/ // @mixin ie-pseudo // @param $styles {String} the styles to apply to the pseudo-element // @param $content {String} the content to insert into the element (similar to css `content` attribute) // @param $placement {String} [before|after] simulate :before or :after behavior // @param $name {String} the name of the element // @param $uid {String} a custom, unique identifier for the generate element @mixin ie-pseudo($styles: false, $content: false, $placement: before, $name: '', $uid: false) { $archetype-pseudo-selector: false; @if $legacy-support-for-ie6 or $legacy-support-for-ie7 { $uid: if($uid, $uid, unique('ie-pseudo-')); $archetype-pseudo-selector: '& ##{$uid}'; $method: if($placement == before, insertBefore, appendChild); $content: if($content and $content != nil, 'this.el.innerHTML="#{-ie-pseudo-content($content)}",', ''); @if $CONFIG_GENERATED_TAG_CSS { $styles: if($styles and $styles != nil, #{$CONFIG_GENERATED_TAG_CSS}#{$styles}, $CONFIG_GENERATED_TAG_CSS); } // if we're using inline styles... $inline: if($styles and $styles != nil and $CONFIG_GENERATED_TAG_INLINE, 'this.el.style.cssText="#{$styles}",', ''); *zoom: expression(this.runtimeStyle.zoom="1", this.el=document.createElement("#{prefixed-tag($name)}"),this.el.id="#{$uid}",#{$content}#{$inline}this.#{$method}(this.el)); // if we're NOT using inline styles... @if not $CONFIG_GENERATED_TAG_INLINE { // output it on the generated selector #{$archetype-pseudo-selector} { @include to-styles(-style-string-to-list($styles)); } } } } // a hack that allows elements with transparent backgrounds to be focusable in IE // @mixin transparent-focusable // @param $url {String} an optional URL to point to an image (not required) // @param $data {String} an optional data URI for a transparent image (not required) @mixin transparent-focusable($url: url(https://), $data: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7') { $bg: (transparent); background: append($bg, $data); @if $url { @include target-browser(ie lte 7, background, append($bg, $url)); } }