Last active
December 15, 2015 18:19
-
-
Save dmitryshimkin/5303328 to your computer and use it in GitHub Desktop.
Less mixin for inserting html via css under IE 5-7. Based on one-time css expression (executed only once, doesn't affect performance). Useful to emulate pseudo-elements, add extra-markup for old browsers or emulate css3 with images.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* mixin */ | |
| .insert-html(@html: "") { | |
| behavior: ~"expression(function html (el) { el.runtimeStyle.behavior = 'none'; if (!el.updated) { el.updated = true; el.insertAdjacentHTML('afterBegin', '@{html}'); } }(this))"; | |
| } | |
| /* usage */ | |
| .some-class { | |
| .insert-html('<span class="shadow"></span>'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment