CSS doesn't apply to dynamically created elements in IE 7?

后端 未结 7 1498
不思量自难忘°
不思量自难忘° 2021-02-13 10:32

Still looking for an answer.

Changing or reassigning to the filter\'s innerHTML successfully redraws the element, but breaks my script, so that\'s out.

7条回答
  •  一向
    一向 (楼主)
    2021-02-13 11:32

    IE6/7 has a lot of problems/bugs/misbehaviours with regard to creating and adding elements in the DOM using createElement. I strongly recommend to switch to jQuery for this since it does all the work in a cross browser compatible manner and has already taken (almost) all the IE6/7 specific misbehaviours into account so that you don't need to end up with a doubled amount of code to get it to work in all browsers the world is aware of. Here's a copy'n'paste'n'runnable SSCCE:

    
    
        
            Test
            
            
            
        
        
            

    Update: as per the comments, jQuery is absolutely not an option. Well, best what you can try is to set element attributes only after the element is been added to the DOM. Also try not to clone nodes in IE6/7, this is often epic fail. Rather create a brand new node from beginning on.

提交回复
热议问题