Reputation: 410
The following code works great on other browsers, but on IE7 & 8 it complains about it:
var divs = $(".paginate-boxes li");
for(var i = 0; i < divs.length; i+=9) {
divs.slice(i, i+9).wrapAll("<li class='slide-portfolio'><ul></ul></li>");
}
The code that it's working on is a long list of li
s like so:
<li>
<!--Fade-->
<div class="mosaic-block fade">
<a href="http://www.example.com/destination/" class="mosaic-overlay">
<object class="details">
<h4>Destination Page</h4>
<p>
</p>
</object>
</a>
<div class="mosaic-backdrop"><img width="296" height="175" src="http://www.example.com/wp-content/uploads/this_thumb.jpg" class="attachment-portfolio-image wp-post-image" alt="this_thumb" title="This image" /></div>
</div>
</li>
Using the Dev tools in IE9 (in 8 mode), I found that it complains when it gets to the .slice
bit of the code, referencing this bit of jQuery (v.1.7.2)
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
}
Not sure exactly what that means tbh
What do I need to change to stop it throwing an error, and why?
Upvotes: 0
Views: 880
Reputation: 410
Rather obvious in retrospect - replace the <object>
with <div>
and it works fine.
Upvotes: 2