#5977 closed bug (fixed)
.html() will strip <style> tags in IE
Reported by: | cmcnulty | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4.2 |
Component: | manipulation | Version: | 1.4.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
see http://forum.jquery.com/topic/html-stripping-style-in-ie-sometimes for discussion.
when using .html() to insert the following html snippet:
"<style type="text/css">
.test { color: red; }
</style> <div id="nav_controls" class="navControls">
<div id="test_div" class="test">A test</div>
</div> "
innerHTML will strip the <style> tags and content, in IE8. The bug can be a bit tricky to reproduce, as the criteria for stripping the style seems to have something to do with preceding whitespace.
I can't reproduce in FF3.6 or Chrome 3. Untested in IE7 or earlier
Attachments (1)
Change History (4)
Changed 13 years ago by
comment:1 Changed 13 years ago by
Component: | unfiled → manipulation |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 Changed 13 years ago by
For the record, the exact same problem exists for <link> with the exact same symptoms, and the exact same work-arounds (inserting a <br/> before the tag)
comment:3 Changed 13 years ago by
When the <style> or <link> tags are preceded with any of the following text, IE will *not* strip the <style/link> tag (non-exhaustive list):
- <br/>
-
- <span>asdf</span>
- <div>asdf</div>
- asdf
IE *will* strip the <style/link> tags if preceded by any of these:
- carriage returns
- multiple blank spaces
- <div></div> (empty div)
- <span></span> (empty span)
test case