gehuangyi20 / ie7-js

Automatically exported from code.google.com/p/ie7-js
0 stars 0 forks source link

Re-apply ie8 after new content has been added to the page (ie7-recalc.js) #111

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I load a lot of the content of my page using AJAX, and I would like to know
how to call IE8 again, so that it can process the new content. Now I'm
re-adding the script after every call, but it's not a pretty method because
it takes a lot of resources.

Thanks, Roger.

Original issue reported on code.google.com by roy...@gmail.com on 7 Sep 2008 at 11:28

GoogleCodeExporter commented 9 years ago
The same problem here. Seems there's no workaround for this, its executed in 
closure.

Original comment by pcicman@gmail.com on 22 Apr 2009 at 1:12

GoogleCodeExporter commented 9 years ago
I will provide a new module (ie7-recalc) that will allow you to refresh the 
IE7.js 
rules. This module is still in development. IE7.js was not really intended for 
dynamic 
pages so I do not consider it a priority to provide support for dynamic pages.

Original comment by dean.edw...@gmail.com on 11 Feb 2010 at 3:31

GoogleCodeExporter commented 9 years ago

Original comment by dean.edw...@gmail.com on 14 Feb 2010 at 12:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This script is amazing but i have to admit that i have the same problem with 
ajax
content. Can't wait for the ie7-recalc.
Cheers

Original comment by leosqua...@gmail.com on 7 May 2010 at 12:23

GoogleCodeExporter commented 9 years ago
Hi just added in the ie7-recalc script to bottom of my dynamic ajax page aswell 
as
called document.recalc(); and it was fixed it!!! 

Original comment by leosqua...@gmail.com on 7 May 2010 at 12:44

GoogleCodeExporter commented 9 years ago
leosquarez, can you link an example because it does not seem to work for me! :|

Original comment by m.ep...@gmail.com on 7 May 2010 at 9:09

GoogleCodeExporter commented 9 years ago
Hello, I very like IE9.js, that's really a wonderful script. However I meet the 
same 
issue as stated above, when adding content using Javascript, the styles are not 
refreshed, and I understand that this is because the IE9.js script is only 
executed 
once after the page has been loaded.

Luckily it seems you developed something to counter this issue, so I tried to 
add 
IE7_recalc.js right after loading IE9.js, but now the script IE9.js does not 
seem to 
change anything on my webpage (as if the script was exiting prematurily). I 
would be 
happy to learn how exactly are we supposed to use IE7_recalc.js ?

I added the following into my <head> tag :

[code]
    <!--[if lt IE 9]>
    <script src="IE9.js" type="text/javascript">
      //<![CDATA[
        IE7_PNG_SUFFIX=".png";
      //]]>
    </script>
    <script src="IE7_recalc.js" type="text/javascript"></script>
    <![endif]-->
[/code]

Then in one button onclick attribute I have the following :
[code]
onclick="javascript:myownfunction();document.recalc();"
[/code]

I had a look at IE7_recalc.js so I also tried with :
[code]
onclick="javascript:myownfunction();document.recalc(true);"
[/code]

Which does not seem to help either.

Thank you for any help !

Original comment by gabylas...@gmail.com on 12 May 2010 at 8:03

GoogleCodeExporter commented 9 years ago
IE7.js was never meant to be dynamic. I wrote it to support CSS, not 
JavaScript. I 
recognise that most people use JavaScript in their web pages now. But if I 
revive ie7-
recalc.js then I know that I am letting myself in for a world of pain regarding 
integration with other libraries.

ie7-recalc.js is not distributed with the standard IE7.js download but it is 
available 
from the trunk. I may go back and re-develop this module but I can't really 
promise 
anything. I'm very tempted to dump it forever.

Original comment by dean.edw...@gmail.com on 12 May 2010 at 10:29

GoogleCodeExporter commented 9 years ago
I understand your position, but I like to share with you my point of view.

I think (not because of an ideology, but because of real engineering 
advantages) that 
we must develop web sites following the standards.
Nowadays web developers create web sites with these requirements:
- advanced and cross-browser user interfaces and layout (read "CSS")
- advanced and cross-browser user interaction features (read "JS, DOM, AJAX")
The first requirement is solved by your wonderful ie7/8/9-js library.
The second requirement is solved by Javascript libraries.

The advantage of your library is that allows you to develop quickly, following 
web 
standards and, moreover, allow you to maintain behaviour and presentation 
separate 
(because you can specify in CSSs what you otherwise need to apply via JS)

My opinion is that not allowing to re-apply the adjustments ie7/8/9-js library 
made 
to a web page will make your library a NOT viable choice in web sites where 
both the 
previous requirements (all the interesting web sites) has to be met and so will 
make 
web developers loose the aforementioned advantages.

Original comment by m.ep...@gmail.com on 13 May 2010 at 12:27

GoogleCodeExporter commented 9 years ago
Hello,
I understand that this is a lot of work, but I am not using any other 
libraries, I 
just add/remove some little content by myself, nothing big. I just can't happen 
to 
make it work even once, after ie7-recalc.js is loaded, IE9.js (or IE8.js or 
IE7.js) 
does not apply its changes after the page is loaded, neither after a call to 
document.recalc(); so this is the origin of my question : how am I supposed 
exactly to 
use ie7-recalc.js ?

Original comment by gabylas...@gmail.com on 13 May 2010 at 5:12

GoogleCodeExporter commented 9 years ago
Ok so, take this with the disclaimer that I might not be doing this exactly 
correct, but I was able to get the recalc stuff to work again.  I downloaded 
the source into my local project from 
http://code.google.com/p/ie7-js/source/browse/trunk/lib/src/ie7-recalc.js.  I 
then started commenting out lines until I found what was breaking things and 
altered it slightly.

These are the lines I changed:

        getText: function (styleSheet) {
            return styleSheet.cssText || this.base(styleSheet);
        }

It's now just:

        getText: function (styleSheet) {
            return this.base(styleSheet);
        }

It SEEMS to be working fine now.  I also added the document.recalc() call into 
an ajaxComplete call in Jquery so I didn't have to go adding it all over the 
project.  As such, I also needed to move the code that creates this function 
out of the recalc script file and into an area where all browsers would see it. 
 I just altered it to check that the IE7 object exists before it does anything:

// allow refreshing of IE7 fixes
document.recalc = function (reload) {
    if (typeof(IE7) === 'object') {
        if (IE7.CSS.screen) {
            if (reload) IE7.CSS.reload();
            IE7.recalc();
        }
    }
};

Like I said, there might be something wrong with my approach, but it seems to 
work well for what I needed.  This is a great library and this was the only 
problem I could really find with it.

Original comment by dlam...@gmail.com on 29 May 2013 at 7:50

GoogleCodeExporter commented 9 years ago
dlam, thank you !! It works indeed. Although what is the reload for? It doesn't 
work if i try to force it and it works just fine if i leave it commented out.

Thanks for working it out.

Original comment by gab...@gmail.com on 2 Jul 2013 at 12:56