EzDevInfo.com

selectivizr

selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8. Selectivizr - CSS3 pseudo-class and attribute selectors for IE 6-8 selectivizr is a javascript utility that emulates css3 selectors in internet explorer 6-8

How do I use Selectivizr to make the Bourbon Neat grid work in IE8?

I have the unfortunate task of making Bourbon Neat work with ie8. Thoughtbot's docs say you use Selectivizr for this. I followed Selectivizr's instructions and I see nothing different when testing in ie8. I also don't understand what if any fallback css is required. Any ideas or solutions? Most appreciated!

<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="description" content="">

<!-- FONTS -->
<!--Typekit - Adrianna Extended Demibold-->
<script type="text/javascript" src="//use.typekit.net/sjw4zgk.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>

<!-- AUTO RELOAD FOR HAMMER -->

        <!-- Hammer reload -->
          <script>
            setInterval(function(){
              try {
                if(typeof ws != 'undefined' && ws.readyState == 1){return true;}
                ws = new WebSocket('ws://'+(location.host || 'localhost').split(':')[0]+':35353')
                ws.onopen = function(){ws.onclose = function(){document.location.reload()}}
                ws.onmessage = function(){
                  var links = document.getElementsByTagName('link'); 
                    for (var i = 0; i < links.length;i++) { 
                    var link = links[i]; 
                    if (link.rel === 'stylesheet' && !link.href.match(/typekit/)) { 
                      href = link.href.replace(/((&|\?)hammer=)[^&]+/,''); 
                      link.href = href + (href.indexOf('?')>=0?'&':'?') + 'hammer='+(new Date().valueOf());
                    }
                  }
                }
              }catch(e){}
            }, 1000)
          </script>
        <!-- /Hammer reload -->


<!-- CSS/SCSS -->
<link rel='stylesheet' rel='nofollow' href='css/ostrich-sans.css'>
<link rel='stylesheet' rel='nofollow' href='css/font-awesome.css'>
<link rel='stylesheet' rel='nofollow' href='css/normalize.css'>
<link rel='stylesheet' rel='nofollow' href='css/responsive-nav.css'>
<link rel='stylesheet' rel='nofollow' href='css/style.css'>

<!-- IOS LINK STYLES -->
<style type="text/css">
/*.applelinks a {color:#c4d52d; display:inline-block; padding: 10px 0;}*/
/*Disable touch-highlight
-webkit-tap-highlight-color: rgba(0,0,0,0); */
</style>

<!-- JS MODERNIZR -->
<script src='js/modernizr.custom.87213.js'></script>

<link rel='nofollow' href="favicon.ico" rel="shortcut icon">
<link rel='nofollow' href="apple-touch-icon.png" rel="apple-touch-icon">


<title>Title</title>

<!-- ZEPTO FALLBACK TO JQUERY -->
<script>
document.write('<script src=' +
('__proto__' in {} ? 'js/zepto.min' : 'js/jquery.min') +
'.js><\/script>')
</script>

<!--[if lte IE 8]>
<script type="text/javascript" src="selectivizr.js"></script>
<![endif]-->   

</head>

<body>

<header>
<nav class="nav-collapse">
  <ul>
    <li><a rel='nofollow' href="#">Home</a></li>
    <li><a rel='nofollow' href="#">About</a></li>
    <li><a rel='nofollow' href="#">Projects</a></li>
    <li><a rel='nofollow' href="#">Contact</a></li>
  </ul>
</nav>
</header>

  <section class="sec-one">

      <aside>Aside</aside>
      <article>Article</article>

  </section>

    <section class="sec-two">
      <aside>Aside</aside>
      <article>Article</article>
  </section>

    <section class="sec-three">
      <aside>Aside</aside>
      <article>Article</article>

    <p>Content copy</p>


  </section>



<script src='js/responsive-nav.js'></script>
<script src='js/app.js'></script>

<!-- INITIATE RESONSIVE-NAV -->
<script>
    var navigation = responsiveNav(".nav-collapse", {
        label: '<i class=\"icon-reorder icon-2x\"></i>'
    });
</script>


</body>

</html>

Source: (StackOverflow)

selectivizr not working for nth-child(2) in IE7 and IE8

Looking at the resulting CSS in IE developer tools a simple rule such as

.filter-dates .date-picker:nth-child(2)
{
    margin-left:200px;
}

shows up in IE as

UNKNOWN
   margin-left:200px;

We use the latest JQuery lib and according to the Selectivizr site nth-child is supported.

Anyone know where I'm going wrong?

Thanks, Jacques


Source: (StackOverflow)

Advertisements

Selectivizr :first-of-type and nth-of-type not working in IE8

I'm starting a new project, and since it won't use much javascript, I decided to switch from Jquery to Mootools only because of the range of pseudo-class selectors it will let me use.

Problem is, it still won't work!

In IE8, I can't get firt-of-type or nth-of-type(2) to properly work!

It works perfectly in Chrome/FF/IE9.

I have emptied the cache I don't know how many times.

Also, I know that Selectivizr is loaded since :first-child actually works in IE8.

Any clues?

Thanks in advance!


Source: (StackOverflow)

Selectivizr - working properly in IE6 but not IE7 & 8 [duplicate]

Possible Duplicate:
Selectivizr Help Please

I'm using Selectivizr to add Advanced Selector Functionality to IE. When I test my site using Adobe Browser Labs, IE6 is displaying the Elements correctly. But IE 7 & 8 are only displaying Elements using :first-child correctly & not the Elements using :nth-of-type & :last-child. Has anyone heard of this happening before. I can't find an answer on the net. Any help is greatly appreciated. Thanks.


Source: (StackOverflow)

Why is it not recommended to use a polyfill for CSS3 selector support?

I need to ensure IE7 and IE8 support.

I'm using a few CSS3 selectors like :last-child. I dropped in Selectivizr, and it appears to fix many problems in those browsers, leaving me just a handful to clean up with some fallback code.

But HTML5 Please recommends using only fallbacks, not polyfills, to address CSS3 selector support:

We strongly recommend you do not try to polyfill this, but if you do need one, you can use Selectivizr.

It would be good to know why they "strongly recommend" against polyfills here... Anyone have any ideas?


Source: (StackOverflow)

Why is selectivizr.js causing "white screen of death" in IE8?

Including selectivizr.js is causing IE8 to not display/render anything at all, but IE8 in IETester manages.

It also downloads everything, I can see that in the activity bar and the DOM inspector. And the links are even there, I see that when moving the cursor around the nav-area. But it doesn't display anything at all.

The only bugfix I've found through a lot of searching is applying zoom: 1; to body, but it doesn't help in my case.

I would appreciate any debugging help I can get. Page preview.


Source: (StackOverflow)

Troubles getting Selectivizr to Work

I am having troubles getting Selectivizr to work even with a very simple page. What did I do wrong?

http://jiewmeng.kodingen.com/playground/selectivr.html

<html>
<head>
    <link rel="stylesheet" rel='nofollow' href="selectivr.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools-yui-compressed.js"></script>
    <!--[if (gte IE 6)&(lte IE 8)]>
      <script src="selectivizr.js"></script>
    <![endif]--> 

</head>

<body>
    <h1>Hello World</h1>
    <p>Paragraph 1</p>

    <p>Paragraph 2</p>
    <p>Paragraph 3</p>
    <p>Paragraph 4</p>
    <p>Paragraph 5</p>
    <p>Paragraph 6</p>
</body>
</html>

CSS

p:nth-child(2n+2) { color: red }

Source: (StackOverflow)

Selectivizr causes select dropdown to require two clicks to open in IE8 & below

I recently implemented Selectivizr on an internal company website as we need to support IE7/8. Unfortunately, our site does a lot of dynamic content loading via jQuery/AJAX.

To solve this problem, I overloaded the jQuery ready function to reload Selectivizr after it performs whatever task it was set out to. My code looks like this:

$(function () {
    if ($('body.ie8, body.ie7, body.comp-view8, body.comp-view7').length > 0) {
        (function () {
            var original = jQuery.fn.ready;
            var getSelectivizr;
            jQuery.fn.ready = function () {
                // Execute the original method.
                original.apply(this, arguments);

                clearTimeout(getSelectivizr);
                getSelectivizr = setTimeout(function () {
                    $.getScript(selectivizr);
                }, 50);
            }

        })();
    }
});

Simple enough. However, a teammate recently discovered a bug that seems to be related. In IE8/7 any select dropdown that is dynamically loaded into the page (I'm not sure if static dropdowns are effected as well as none of these pages have them), requires two clicks to open it.

To be more specific, in IE8/7, the first click seems to "focus" on the dropdown, while the second opens it. It Compatibility View, it actually opens for a split-second and then closes. The second click opens it just fine (as long as you remain focused on the dropdown).

I had assumed it might be an issue with what Selectivizr was doing, as it wasn't really designed to work with dynamically loaded content, but after a little bit of debugging, it seems that it's the setTimeout that is causing this strange behavior.

I'm at a complete loss how to fix this without removing my Selectivizr implementation.

It is probably worth noting that the setTimeout is necessary to prevent the browser from attempting to load Selectivizr multiple times if different AJAX calls are made as this can cause serious performance issues within the browser.

Note: this question does not accurately reflect the issue stated in the title, so I updated it to provide better searching! After coming back to this problem a few weeks later, I recognized that my initial debugging had led me down the wrong path. Sorry folks, but I've provided an answer to this which I hope helps!:)


Source: (StackOverflow)

IE8 CSS background image URL being reset to url("null")

I have an issue at the moment where in IE8 my background-image properties in CSS files are being changed to url("null") instead of the original URL that's in there.

Not sure where to look, but I suspect it could be selectivizr or JQuery UI.

Anyone experience this problem before?

EDIT: Here's the CSS code

span.k-icon
{
    background-image: url('http://cdn.kendostatic.com/2012.2.710/styles/Default/sprite.png');
}

EDIT 2: I removed selectivizr out of the equation, which solves the problem. So this is definitely something to do with selectivizr. Regards, Jacques


Source: (StackOverflow)

Using uglify grunt task messes up selectivizr

I have a Yeoman project that uses grunt-contrib-uglify on its Javascript files. When run on the Selectvizr library (pulled in using Bower) the resultant file looks like this:

!function(win){return}(this);

I think that's because Selectivizr is setup to not do anything if the browser isn't IE, so perhaps in the Grunt execution context it's doing just that?

So I want to know if it's possible to have Uglify run on Selectivizr and produce something usable?


Source: (StackOverflow)

Make first-child and last-child work in IE8

In my project, I am trying to make the below css work in IE8 using selectivizr

thead>tr:first-child>th:last-child {
    color: red;
}
tbody>tr:first-child>td:last-child {
    color: red;
}

As described in Selectivizr website, I added the below code in "External Resources" of JSFiddle.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!--[if (gte IE 6)&(lte IE 8)]>
  <script type="text/javascript" src="https://github.com/keithclark/selectivizr/blob/master/selectivizr.js"></script>
  <noscript><link rel="stylesheet" rel='nofollow' href="[fallback css]" /></noscript>
<![endif]-->

Still I can't make first-child and last-child pseudo selectors work in IE8.

I am switching all the versions of IE into IE8 using the following code. (just for information).

<meta http-equiv="X-UA-Compatible" content="IE=8" >

Source: (StackOverflow)

CSS selector attr *= support in IE8

I noticed selectivizr does not support [attr*=] using jQuery.

Any ideas on how I could support the following selector in ie8?

a:not([class*="st-"])

Source: (StackOverflow)

HTML5 Boilerplate + Conditional Comments

I am using the HTML5 Boilerplate and never had a problem with it until now, when I have started using Selectivizr. For some reason, which I dont understand, IE8 produced a Javascript error.

After some testing, I noticed that the error was gone when I stopped using the conditional browser comments (in the Boilerplate) that add a class to html depending on the browser you are using:

<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

As I said, when I remove the code above and replace it with <html> everything works fine.

Since I dont want to remove the conditional comments completely (they help me to write browser specific css), I thought of doing the same, but instead of applying it to html I will do it for the <body>:

<!--[if lt IE 7]> <body class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <body class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <body class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <body class="no-js" lang="en"> <!--<![endif]-->

Everything seems to work okay, but since I am a newbie, I would just like to verify that this workaround is okay? Or is there a downside?

And one more question offtopic: When a user visits the site with Firefox or Chrome, what body will be "used"? I guess it will "use" body without a class?

My logic would tell me to write another conditional comment, to make sure to "use" body for all other browsers, however in the official Boilerplate template no such comment exists and therefor I guess its not needed... Why not?


Source: (StackOverflow)

Selectivizr IE8 White screen of death

I'm using Respond.js and Selectivizr for IE8 media query and CSS3 property support. Unfortunately it causes this famous white screen of death...

When removing the selectivizr script it's working fine. I searched through stackoverflow and found some workarounds that didn't work for me.

What I've tried:

  • Loading Selectivizr before Respond.js
  • Updated both libraries to the newest version
  • Remove other libraries/plugins
  • <meta http-equiv="X-UA-Compatible" content="IE=8" />

What I'm using:

  • jQuery
  • Respond.js
  • Selectivizr
  • Modernizr
  • Require.js

HTML:

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="lt-ie9 lt-ie8 lt-ie7 no-js"> <![endif]-->
<!--[if IE 7]>         <html class="lt-ie9 lt-ie8 no-js"> <![endif]-->
<!--[if IE 8]>         <html class="lt-ie9 no-js"> <![endif]-->
<!--[if IE 9]>         <html class="ie9 no-js"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js"> <!--<![endif]-->

<head>
    <title><?php echo $portal_name . " " . $pageTitle; ?></title>
    <meta charset="utf-8">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="apple-touch-icon" rel='nofollow' href="/images/global/apple-touch-icons/<?php echo $portal; ?>-touch-icon-iphone.png" />
    <link rel="apple-touch-icon" sizes="76x76" rel='nofollow' href="/images/global/apple-touch-icons/<?php echo $portal; ?>-touch-icon-ipad.png" />
    <link rel="apple-touch-icon" sizes="120x120" rel='nofollow' href="/images/global/apple-touch-icons/<?php echo $portal; ?>-touch-icon-iphone-retina.png" />
    <link rel="apple-touch-icon" sizes="152x152" rel='nofollow' href="/images/global/apple-touch-icons/<?php echo $portal; ?>-touch-icon-ipad-retina.png" />
    <link rel="stylesheet" rel='nofollow' href="/css/<?php echo $portal; ?>.css">
    <script src="/js/vendor/modernizr.custom.min.js"></script>
    <script src="/js/vendor/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
    // add specific class to html when windows
    if (navigator.appVersion.indexOf("Win")!=-1){
        $('html').addClass('win');
    }

    // add specific class to html when chrome
    if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1){
        $('html').addClass('chrome');
    }
    </script>
    <!--[if lt IE 9]>
        <script type="text/javascript" src="/js/plugins/jquery.selectivizr.min.js"></script>
        <script type="text/javascript" src="/js/vendor/respond.min.js"></script>
    <![endif]-->        
    <script async data-main="/js/app" src="/js/vendor/require.min.js"></script>
</head>

Any suggestions how to solve this?


Source: (StackOverflow)

How to get IE to be Responsive? Selectivizr?

The start of my page is as follows

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Database Reports</title>
    <link rel='nofollow' href='http://fonts.googleapis.com/css?family=Oxygen:400,300' rel='stylesheet' type='text/css'>
    <link rel='nofollow' href='css/style.css' rel='stylesheet' type='text/css'>
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if (gte IE 6)&(lte IE 8)]>
        <script src="js/selectivizr-min.js"></script>
    <![endif]-->
</head>

Then within the body I have several DIVs

<div class="left"></div>
...
<div class="left"></div>

My CSS is as follows

.left {
    width: 30%;
    float: left;
    margin: 5px;
}

.left:nth-child(4) {
        clear: both;
}

@media screen and (max-width: 1024px) {
    .left {
        width: 40%;
    }

    .left:nth-child(4) {
        clear: none;
    }

    .left:nth-child(3) {
        clear: both;
    }
}

@media screen and (max-width: 800px) {
    .left {
        width: 80%;
    }

    .left:nth-child(4), .left:nth-child(3) {
        clear: none;
    }

    .left:nth-child(2) {
        clear: both;
    }
}

In Firefox and Chrome, it all works well. In full resolution, there are 3 columns and then a break, 3 columns and then a break etc

When browser resized (smaller) there are 2 columns, a break 2 columns, a break etc.

I have IE8 and if I turn off compatiablity mode, there are 3 columns and then a break (as describe above) but when I resize the browser, nothing happens. It always stays at 3 columns.

When i put compatiablity mode back on (most users in the company will have this) or use IE7, there's no breaking occuring or any responsiveness.

Any advice/help would be greatly appreciated


Source: (StackOverflow)