[wp-trac] [WordPress Trac] #63821: Proposal: Drop support for IE conditional scripts and styles

WordPress Trac noreply at wordpress.org
Tue Aug 12 17:02:26 UTC 2025


#63821: Proposal: Drop support for IE conditional scripts and styles
-----------------------------+-----------------------------
 Reporter:  jonsurrell       |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:  javascript, css  |
-----------------------------+-----------------------------
 WordPress supports for HTML "conditional" comments in
 [https://core.trac.wordpress.org/browser/tags/6.8.2/src/wp-includes/class-
 wp-scripts.php#L322 scripts] and
 [https://core.trac.wordpress.org/browser/tags/6.8.2/src/wp-includes/class-
 wp-styles.php#L173 styles]. These were typically used to target specific
 Internet Explorer versions
 [https://codex.wordpress.org/Conditional_Comment_CSS as documented on this
 codex page]. For example:

 {{{#!xml
 <!--[if lte IE 7]>
 <link rel="stylesheet" href="/ie7.css" media="screen" type="text/css" />
 <![endif]-->
 }}}

 [https://learn.microsoft.com/en-us/previous-versions/windows/internet-
 explorer/ie-developer/compatibility/hh801214(v=vs.85)?redirectedfrom=MSDN
 Microsoft dropped support for conditional comments in IE10] when it was
 released 12 years ago, making IE9 the final version to support conditional
 comments.

 As far as I can tell, global usage of IE9 is basically 0.

 I propose support for conditionals scripts and styles be deprecated and
 conditional script and styles not printed to the page at all.

 Any modern browser treats these script tags as a single HTML comment, so
 these conditional comments should never used by any post-IE9 browser.
 [https://software.hixie.ch/utilities/js/live-dom-viewer/ This HTML
 constructs the following tree]:

 {{{#!xml
 <!DOCTYPE html>
 <body>
 <!--[if]>
 <script>alert('script')</script>
 <![endif]-->
 }}}

 {{{
 ├─DOCTYPE: html
 └─HTML
   ├─HEAD
   └─BODY
     ├─#text
     └─#comment [if]> <script>alert('script')</script> <![endif]
 }}}

 There is no script tag present in that page and it seems that there's no
 place for these conditional script and style tags in today's web.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63821>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list