keithclark / selectivizr

selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8.
1.71k stars 246 forks source link

Add a mechanism to run selectivizr at a specific time #59

Open ianthedev opened 11 years ago

ianthedev commented 11 years ago

Sometimes we change HTML elements' structure or add new elements by JavaScripting. In such cases, Selectivizr may not work for those elements. So could we have a mechanism to run Selectivizr at a specific time? Such as after all elements have been modified by JavaScripting.

For example:

<script>
var selectivizrPause = true; // this variable tells Selectivizr to not execute after it has been loaded.
</script>
<script src="selectivizr.js"></script>

Then we could add the following line at the end of $(document).ready(function() { }) (after all DOM modification codes) to run Selectivizr.

selectivizrRun();
lzl124631x commented 9 years ago

Upvote.

I met a problem: after an element is replaced by replaceWith, the new element has no hover effect because selectivizr doesn't re-apply on the new element. I have to manually attach hover function on the new element.

Please provide a function that I can re-invoke selectivizr after some element substitution using js.